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:
Sean Rose 2023-06-09 09:15:40 -07:00 коммит произвёл GitHub
Родитель 8423c7ad2e
Коммит b7b7c23913
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -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."""