My goal is to receive csv files in S3, convert them to avro, and validate them against the appropriate schema in AWS.
I created a series of schemas in AWS Glue Registry based on the .avsc files I already had:
{
"namespace": "foo",
"type": "record",
"name": "bar.baz",
"fields": [
{
"name": "column1",
"type": ["string", "null"]
},
{
"name": "column2",
"type": ["string", "null"]
},
{
"name": "column3",
"type": ["string", "null"]
}
]
}
But once I try and pull the schemas from Glue the API doesn't seem to provide definition details:
glue = boto3.client('glue')
glue.get_schema(
SchemaId={
'SchemaArn': schema['SchemaArn']
}
)
returns:
{
'Compatibility': 'BACKWARD',
'CreatedTime': '2021-08-11T21:09:15.312Z',
'DataFormat': 'AVRO',
'LatestSchemaVersion': 2,
'NextSchemaVersion': 3,
'RegistryArn': '[my-registry-arn]',
'RegistryName': '[my-registry-name]',
'ResponseMetadata': {
'HTTPHeaders': {
'connection': 'keep-alive',
'content-length': '854',
'content-type': 'application/x-amz-json-1.1',
},
'HTTPStatusCode': 200,
'RetryAttempts': 0,
},
'SchemaArn': '[my-schema-arn]',
'SchemaCheckpoint': 2,
'SchemaName': '[my-schema-name]',
'SchemaStatus': 'AVAILABLE',
'UpdatedTime': '2021-08-11T21:09:17.312Z',
}
Is there a way to programmatically retrieve the Glue Schema Registry definitions for a schema? Or am I taking the wrong approach here with what I'm trying to do?