Skip to content

Instantly share code, notes, and snippets.

@Geremie
Created May 19, 2022 14:54
Show Gist options
  • Save Geremie/1dc5900ad626659f8cc8725780489329 to your computer and use it in GitHub Desktop.
Save Geremie/1dc5900ad626659f8cc8725780489329 to your computer and use it in GitHub Desktop.
Do Yourself a Favor and Stay Away from BigQuery Schema Auto-detection
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