Created
June 1, 2020 13:30
-
-
Save jaklinger/cfb330c501379b7ae14a0fd77e05f65d to your computer and use it in GitHub Desktop.
dump schema from data_getters
This file contains hidden or 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
from collections import defaultdict | |
ignore = ["2020", "onsOpenGeo", 'worldbank', 'table_updates'] | |
out_data = defaultdict(dict) | |
for dataset, tables in schemas.items(): | |
for name, table in tables.items(): | |
if any(i in name for i in ignore): | |
continue | |
table = [dict(field_name=str(c.key), type=str(c.type), primary_key=c.primary_key, nullable=c.nullable) | |
for c in table.columns] | |
out_data[dataset][name] = table | |
with open("schema_dump.yaml", "w") as f:yaml.dump(dict(out_data), f, allow_unicode=True, indent=4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment