Separate the schema from the S3 data
How CTAS and INSERT INTO transform cataloged S3 data into partitioned datasets, with partition keys and predicates chosen to limit data scanned. · advanced
Athena transformations start with cataloged S3 data. The objects contain the data; the AWS Glue Data Catalog stores metadata such as table and column names. A catalog table gives SQL a schema through which to address the S3 dataset.
Schema creation is shared across Athena and AWS Glue: schemas created in Glue can be queried in Athena, and schemas created in Athena can be used in Glue. Glue crawlers can infer database and table schemas automatically from S3 data.
Keep these two outputs separate when thinking about a transformation: the destination needs both transformed data in S3 and catalog metadata that makes that data queryable.