-
Notifications
You must be signed in to change notification settings - Fork 19
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
New query style for obsdb which enables to use external database #856
base: master
Are you sure you want to change the base?
Conversation
I think it is ready to go. |
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.
This is neat! I want to experiment with it a bit more. The docstring details are appreciated but can you add some basic tests?
Thank you, Matthew. |
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.
Sorry it took me so long to get to this. This is a really useful capability to have!
My requests for now are:
- deal with too-long lines (marked inline)
- squash and rebase
In the longer term I think we should update the interface so that:
- Extend ObsDb so that 'attach' can occur on the base ObsDb object, allowing access to merged fields in any request (including
.get
), without passing subdb_info to each call - Extent Context so it can attach obsdb extensions automatically.
- Include more description of this feature in the docs.
But we don't need to deal with that stuff now.
sotodlib/core/metadata/obsdb.py
Outdated
cursor = self.conn.cursor() | ||
|
||
try: | ||
extra_fields_main, joins_main, query_text_main = _generate_query_components_from_tags(query_text=query_text, tags=tags) |
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.
Line too long; use \
sotodlib/core/metadata/obsdb.py
Outdated
aliases.append(alias) | ||
attach = f"ATTACH DATABASE '{filepath}' AS '{alias}'" | ||
cursor = cursor.execute(attach) | ||
_extra_fields_sub, _join_sub, _query_sub = _generate_query_components_from_subdb(filepath=filepath, |
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.
Please reduce line lengths here.
You could pass **subdb_info
instead of all these .get(...)?
sotodlib/core/metadata/obsdb.py
Outdated
If you do not know the parameters in the sub-database, you can view the params | ||
as long as it is a ManifestDb like below:: | ||
|
||
from sotolib.core import metadata |
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.
sotodlib.core
In combination with #850, I added handling for querying an external ManifestDB in which a field, in this case
I can successfully retrieve that entry with the following query:
|
Hi @davidvng and @tterasaki -- who is going to deal with my requested changes to the original PR? @davidvng On the "coverage" changes -- those seem fine but you need to clean up the testing function (remove prints, restore mpi check). |
new query style for obsdb which enables to use external database.