Skip to content

Commit

Permalink
Merge pull request #928 from lsst/tickets/DM-41113
Browse files Browse the repository at this point in the history
DM-41113: Add dimension record containers.
  • Loading branch information
TallJimbo authored Dec 21, 2023
2 parents 480261b + 8b1cc48 commit 747d2cb
Show file tree
Hide file tree
Showing 33 changed files with 2,793 additions and 689 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: "3.11"
cache: "pip"
cache-dependency-path: "setup.cfg"

Expand Down
3 changes: 3 additions & 0 deletions doc/changes/DM-41113.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Added `DimensionElement.schema` as a less SQL-oriented way to inspect the fields of a `DimensionRecord`.

Also added two high-level containers (`DimensionRecordSet` and `DimensionRecordTable`) for `DimensionRecord` objects, but these should be considered experimental and unstable until they are used in public `Butler` APIs.
4 changes: 4 additions & 0 deletions doc/lsst.daf.butler/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@ General utilities
:no-main-docstr:
:headings: ^"

.. automodapi:: lsst.daf.butler.timespan_database_representation
:no-main-docstr:
:headings: ^"

.. automodapi:: lsst.daf.butler.utils
:no-main-docstr:
:headings: ^"
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/daf/butler/_column_type_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@

from . import ddl
from ._column_tags import DatasetColumnTag, DimensionKeyColumnTag, DimensionRecordColumnTag
from ._timespan import TimespanDatabaseRepresentation
from .dimensions import Dimension, DimensionUniverse
from .timespan_database_representation import TimespanDatabaseRepresentation

LogicalColumn = sqlalchemy.sql.ColumnElement | TimespanDatabaseRepresentation
"""A type alias for the types used to represent columns in SQL relations.
Expand Down
6 changes: 6 additions & 0 deletions python/lsst/daf/butler/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ def model_dump_json(
) -> str:
return ""

def model_copy(self, *, update: dict[str, Any] | None = None, deep: bool = False) -> Self:
raise NotImplementedError("For type-checking only.")

@property
def model_fields(self) -> dict[str, FieldInfo]: # type: ignore
return {}
Expand Down Expand Up @@ -255,6 +258,9 @@ def model_dump(
exclude_none=exclude_none,
)

def model_copy(self, *, update: dict[str, Any] | None = None, deep: bool = False) -> Self:
return self.copy(update=update, deep=deep)

@classmethod
def model_validate_json(
cls,
Expand Down
Loading

0 comments on commit 747d2cb

Please sign in to comment.