简体   繁体   中英

Extract data from AWS Glue Data Catalog to a text file externally

I am writing a python script which should read metadata (only the schema) present in AWS Glue Data Catalog and write it to text files. How to go about this?

You can use the boto3 python api for querying the table metadata from glue catalog.

Sample code:

import boto3
client = boto3.client('glue')
response = client.get_table(
    DatabaseName='<your_database_name>',
    Name='<your_table_name>'
)
print response

You can parse to response (json) to extract the required metadata and dump it to file.

Reference documentation: Boto3 - Glue Catalog - Get Table

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM