From 19f168b3b020b0c0511eb707b7d40234d5f7d404 Mon Sep 17 00:00:00 2001 From: Joel Wright Date: Mon, 12 Jun 2023 14:44:55 +0100 Subject: [PATCH] Minor fix to TaxonomyEntry type & initial data loading --- app/core/ingestion/metadata.py | 4 ++-- app/data_migrations/populate_taxonomy.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/core/ingestion/metadata.py b/app/core/ingestion/metadata.py index 78979337..1d5b6933 100644 --- a/app/core/ingestion/metadata.py +++ b/app/core/ingestion/metadata.py @@ -1,4 +1,4 @@ -from typing import Any, Mapping, Sequence, Union, Optional +from typing import Any, Mapping, Sequence, Union from pydantic.dataclasses import dataclass from pydantic.config import ConfigDict, Extra @@ -13,7 +13,7 @@ class TaxonomyEntry: allow_blanks: bool allowed_values: Sequence[str] - allow_any: Optional[bool] = False + allow_any: bool = False Taxonomy = Mapping[str, TaxonomyEntry] diff --git a/app/data_migrations/populate_taxonomy.py b/app/data_migrations/populate_taxonomy.py index 728e32d3..680a884c 100644 --- a/app/data_migrations/populate_taxonomy.py +++ b/app/data_migrations/populate_taxonomy.py @@ -24,6 +24,7 @@ def populate_org_taxonomy( ) db.add(org) db.flush() + db.commit() metadata_org = ( db.query(MetadataOrganisation) @@ -46,6 +47,7 @@ def populate_org_taxonomy( ) ) db.flush() + db.commit() def populate_taxonomy(db: Session) -> None: