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