Skip to content
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-41029: Add metadata table to APDB schema #171

Merged
merged 1 commit into from Jan 24, 2024
Merged

Conversation

andy-slac
Copy link
Contributor

This also adds version number to APDB schema and "advances" it to 0.1.1, all schema versions before metadata are considered 0.1.0.

@gpdf
Copy link
Collaborator

gpdf commented Dec 5, 2023

@andy-slac Can you describe how the new metadata table will be used?

@andy-slac
Copy link
Contributor Author

Can you describe how the new metadata table will be used?

One purpose is to hold schema version, some details are in https://dmtn-269.lsst.io/. There may be other uses to store per-database information, e.g. instrument name. This should be considered as implementation detail, I'm not even sure that it needs to be in sdm_schemas, but my impression is that people prefer to have it here.

Copy link
Contributor

@cbanek cbanek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable

Copy link
Contributor

@parejkoj parejkoj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to confirm: this would make the stored version numbers strings, so we'd have to do some version parsing with an appropriate library to compare them? I think that's fine, I just wanted to check.

Comment on lines +13 to +14
- name: name
"@id": "#metadata.name"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we call this key, in keeping with python dictionaries (which this effectively is), or is name the typical database term for this kind of key:value store?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

key is more natural, but in some database systems key is a reserved keyword and needs special care when used as column name (proper quoting). It's easier to avoid using keywords for column names.

@andy-slac
Copy link
Contributor Author

andy-slac commented Jan 19, 2024

Just to confirm: this would make the stored version numbers strings, so we'd have to do some version parsing with an appropriate library to compare them? I think that's fine, I just wanted to check.

Right, all values are stored as strings in the metadata table and need de/serialization if original type is different from string. This will need client-side code to do that transformation. It's hard to implement generic type-safe storage, at this point I think we are OK with handling this entirely on client side. Version numbers for APDB will be stored in SemVer format (X.Y.Z) and there is a class to support that format, for other potential cases I think we can introduce some helper methods when necessary.

@gpdf
Copy link
Collaborator

gpdf commented Jan 23, 2024

@andy-slac We've been fiddling with some of the test workflows in this repo. You may want to trigger a re-run of the tests.

This also adds version number to APDB schema and "advances" it to 0.1.1,
all schema versions before metadata are considered 0.1.0.
@andy-slac andy-slac merged commit 967b9fb into main Jan 24, 2024
4 checks passed
@andy-slac andy-slac deleted the tickets/DM-41029 branch January 24, 2024 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants