Created
October 20, 2019 18:02
-
-
Save mshakhomirov/bed6b52b3dedbc2ad51e07ec42b2614b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_schema_from_yaml(table_schema): | |
schema = [] | |
for column in table_schema: | |
schemaField = bigquery.SchemaField(column['name'], column['type'], column['mode']) | |
schema.append(schemaField) | |
if column['type'] == 'RECORD': | |
schemaField._fields = create_schema_from_yaml(column['fields']) | |
return schema |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment