Skip to content

Commit

Permalink
Merge pull request #42 from lsst/tickets/DM-42489
Browse files Browse the repository at this point in the history
DM-42489: Freeze APDB configuration in metadata table
  • Loading branch information
andy-slac committed Feb 26, 2024
2 parents 011c388 + d77e54a commit 4b4d39a
Show file tree
Hide file tree
Showing 14 changed files with 512 additions and 256 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.12.1
rev: 24.1.1
hooks:
- id: black
# It is recommended to specify the latest version of Python
Expand All @@ -23,6 +23,6 @@ repos:
name: isort (python)
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.14
rev: v0.2.0
hooks:
- id: ruff
13 changes: 10 additions & 3 deletions python/lsst/dax/apdb/apdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,16 +169,23 @@ def tableDef(self, table: ApdbTables) -> Table | None:
"""
raise NotImplementedError()

@abstractmethod
def makeSchema(self, drop: bool = False) -> None:
@classmethod
def makeSchema(cls, config: ApdbConfig, *, drop: bool = False) -> None:
"""Create or re-create whole database schema.
Parameters
----------
config : `ApdbConfig`
Instance of configuration class, the type has to match the type of
the actual implementation class of this interface.
drop : `bool`
If True then drop all tables before creating new ones.
"""
raise NotImplementedError()
# Dispatch to actual implementation class based on config type.
from .factory import apdb_type

klass = apdb_type(config)
klass.makeSchema(config, drop=drop)

@abstractmethod
def getDiaObjects(self, region: Region) -> pandas.DataFrame:
Expand Down

0 comments on commit 4b4d39a

Please sign in to comment.