DEV Community

Dendi Handian
Dendi Handian

Posted on

Generating Table Schema from AWS Glue Table

Rather than copying the schema columns from the aws console or even from Athena sidebar, you could generate the schema from existing table using query:

SELECT 
 column_name
, ordinal_position
, column_default
, is_nullable
, data_type
, comment
, extra_info
FROM information_schema.columns
WHERE table_schema = 'TABLE_DATABASE' AND table_name='TABLE_NAME'
Enter fullscreen mode Exit fullscreen mode

The above query will return all the necessary information about the table columns and you can copy them as CSV value from the athena result copy button.

Top comments (0)