Preserve the order of column schema properties in `schema.yaml` files. (#3923)
When using `bqetl query schema update` to create a new `schema.yaml` file, BigQuery returns the column schema properties in a sensible order (`name`, `type`, `mode`, `fields`), but our `schema.yaml` output has been sorting those properties alphabetically which makes it much less readable. Also, when using `bqetl query schema update` to update an existing `schema.yaml` file, this will now preserve whatever order the column schema properties were in.
This commit is contained in:
Родитель
8423c7ad2e
Коммит
b7b7c23913
|
@ -270,7 +270,7 @@ class Schema:
|
|||
def to_yaml_file(self, yaml_path: Path):
|
||||
"""Write schema to the YAML file path."""
|
||||
with open(yaml_path, "w") as out:
|
||||
yaml.dump(self.schema, out, default_flow_style=False)
|
||||
yaml.dump(self.schema, out, default_flow_style=False, sort_keys=False)
|
||||
|
||||
def to_json_file(self, json_path: Path):
|
||||
"""Write schema to the JSON file path."""
|
||||
|
|
Загрузка…
Ссылка в новой задаче