Skip to content

Commit

Permalink
Fix sqlite tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartmcalpine committed Jan 3, 2025
1 parent 4e1a4f5 commit 2cd2ee0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/dataregistry/db_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def _get_db_info(prov_table, get_associated_production=False):
if prov_name not in metadata.tables:
raise DataRegistryException(
f"Incompatible database: no Provenance table {prov_name}, "
f"listed tables are {self._metadata.tables}"
f"listed tables are {metadata.tables}"
)

# Don't go on to query the provenance table during schema creation
Expand Down
10 changes: 8 additions & 2 deletions src/dataregistry/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,10 @@ def resolve_alias(self, alias):
If no such alias is found, return None, None
"""
tbl_name = f"{self.db_connection.active_schema}.dataset_alias"
if self.db_connection.dialect == "sqlite":
tbl_name = f"dataset_alias"
else:
tbl_name = f"{self.db_connection.active_schema}.dataset_alias"
tbl = self.db_connection.metadata["tables"][tbl_name]
if isinstance(alias, int):
filter_column = "dataset_alias.dataset_alias_id"
Expand Down Expand Up @@ -659,7 +662,10 @@ def find_aliases(
)

# This is always a query of a single table: dataset_alias
tbl_name = f"{self.db_connection.active_schema}.dataset_alias"
if self.db_connection.dialect == "sqlite":
tbl_name = f"dataset_alias"
else:
tbl_name = f"{self.db_connection.active_schema}.dataset_alias"
tbl = self.db_connection.metadata["tables"][tbl_name]
if property_names is None:
stmt = select("*").select_from(tbl)
Expand Down

0 comments on commit 2cd2ee0

Please sign in to comment.