Created
May 19, 2022 14:54
-
-
Save Geremie/1dc5900ad626659f8cc8725780489329 to your computer and use it in GitHub Desktop.
Do Yourself a Favor and Stay Away from BigQuery Schema Auto-detection
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
import json | |
schema = [ | |
{ | |
"description": "Name of the house", | |
"name": "name", | |
"type": "STRING", | |
"mode": "REQUIRED" | |
}, | |
{ | |
"description": "Address of the house", | |
"name": "address", | |
"type": "RECORD", | |
"mode": "REQUIRED", | |
"fields": [ | |
{ | |
"description": "Primary address of the house", | |
"name": "adress1", | |
"type": "STRING", | |
"mode": "REQUIRED" | |
}, | |
{ | |
"description": "Secondary address of the house", | |
"name": "address2", | |
"type": "STRING", | |
"mode": "NULLABLE" | |
} | |
] | |
} | |
] | |
with open('address_schema.json', 'w') as _f: | |
json.dump(schema, _f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment