-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DM-41158: (mostly) implement QueryDriver for DirectButler #915
Changes from all commits
61f438d
6ebc934
2504bcf
ece2431
ec57484
3c04617
53092e0
08639c7
c73556e
0015626
2546a02
b76888c
722ae4c
1c3729e
b29f78a
2ca5451
3852316
b8d4454
f045ba3
98fe0c7
e4b6b13
f5a5b56
8a03dd5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,7 @@ | |
from ._timespan import Timespan | ||
from .datastore import Datastore, NullDatastore | ||
from .dimensions import DataCoordinate, Dimension | ||
from .direct_query_driver import DirectQueryDriver | ||
from .progress import Progress | ||
from .queries import Query | ||
from .registry import ( | ||
|
@@ -2136,7 +2137,13 @@ def dimensions(self) -> DimensionUniverse: | |
@contextlib.contextmanager | ||
def _query(self) -> Iterator[Query]: | ||
# Docstring inherited. | ||
raise NotImplementedError("TODO DM-41159") | ||
driver = DirectQueryDriver( | ||
self._registry._db, self.dimensions, self._registry._managers, self._registry.defaults | ||
) | ||
query = Query(driver) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if we also want to call There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, good idea. Long term I think this can probably be the only way a caching context gets entered, which will hopefully let us get the caching out of the managers entirely, but entering the current caching context here is what makes sense right now. |
||
with self._caching_context(): | ||
with driver: | ||
yield query | ||
|
||
def _preload_cache(self) -> None: | ||
"""Immediately load caches that are used for common operations.""" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# This file is part of daf_butler. | ||
# | ||
# Developed for the LSST Data Management System. | ||
# This product includes software developed by the LSST Project | ||
# (http://www.lsst.org). | ||
# See the COPYRIGHT file at the top-level directory of this distribution | ||
# for details of code ownership. | ||
# | ||
# This software is dual licensed under the GNU General Public License and also | ||
# under a 3-clause BSD license. Recipients may choose which of these licenses | ||
# to use; please see the files gpl-3.0.txt and/or bsd_license.txt, | ||
# respectively. If you choose the GPL option then the following text applies | ||
# (but note that there is still no warranty even if you opt for BSD instead): | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
from ._driver import DirectQueryDriver | ||
from ._postprocessing import Postprocessing | ||
from ._query_builder import QueryBuilder, QueryJoiner |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this nameshrinker argument be non-optional? I would think that if it is ever needed, it will always be needed... otherwise different parts of the code can think names are different. Just creates the potential for certain columns to work with some types of queries/operations but not others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to do that at a higher level, because the set of names that need shrinking is limited to only those constructed from dataset type names, and that keeps name-shrinker arguments from sprouting up in many more places.