Coverage for python/lsst/daf/butler/registry/queries/_sql_query_backend.py: 64%
18 statements
« prev ^ index » next coverage.py v6.4.4, created at 2022-09-30 02:19 -0700
« prev ^ index » next coverage.py v6.4.4, created at 2022-09-30 02:19 -0700
1# This file is part of daf_butler.
2#
3# Developed for the LSST Data Management System.
4# This product includes software developed by the LSST Project
5# (http://www.lsst.org).
6# See the COPYRIGHT file at the top-level directory of this distribution
7# for details of code ownership.
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.
21from __future__ import annotations
23__all__ = ("SqlQueryBackend",)
25from typing import TYPE_CHECKING
27from ._query_backend import QueryBackend
29if TYPE_CHECKING: 29 ↛ 30line 29 didn't jump to line 30, because the condition on line 29 was never true
30 from ...core import DimensionUniverse
31 from ..interfaces import Database
32 from ..managers import RegistryManagerInstances
35class SqlQueryBackend(QueryBackend):
36 """An implementation of `QueryBackend` for `SqlRegistry`.
38 Parameters
39 ----------
40 db : `Database`
41 Object that abstracts the database engine.
42 managers : `RegistryManagerInstances`
43 Struct containing the manager objects that back a `SqlRegistry`.
44 """
46 def __init__(
47 self,
48 db: Database,
49 managers: RegistryManagerInstances,
50 ):
51 self._db = db
52 self._managers = managers
54 @property
55 def managers(self) -> RegistryManagerInstances:
56 # Docstring inherited.
57 return self._managers
59 @property
60 def universe(self) -> DimensionUniverse:
61 # Docstring inherited.
62 return self._managers.dimensions.universe