Skip to content

Commit

Permalink
Fix production check for sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartmcalpine committed Sep 15, 2024
1 parent 872cff1 commit e932654
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/dataregistry/registrar/base_table_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def __init__(self, db_connection, root_dir, owner, owner_type):
# Database engine and dialect.
self._engine = db_connection.engine
self._schema = db_connection.schema
self._dialect = db_connection._dialect

# Link to Table Metadata.
self._metadata_getter = TableMetadata(db_connection)
Expand Down
12 changes: 5 additions & 7 deletions src/dataregistry/registrar/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,11 @@ def _validate_register_inputs(
if kwargs_dict["owner"] != "production":
raise ValueError("`owner` for production datasets must be 'production'")
else:
if (
self._metadata_getter.is_production_schema
or kwargs_dict["test_production"]
):
raise ValueError(
"Only owner_type='production' can go in the production schema"
)
if self._dialect != "sqlite" and not kwargs_dict["test_production"]:
if self._metadata_getter.is_production_schema:
raise ValueError(
"Only owner_type='production' can go in the production schema"
)

# Validate the keywords (make sure they are registered)
if len(kwargs_dict["keywords"]) > 0:
Expand Down

0 comments on commit e932654

Please sign in to comment.