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

U/jrbogart/in place mod #180

Merged
merged 17 commits into from
Mar 12, 2025
Merged

U/jrbogart/in place mod #180

merged 17 commits into from
Mar 12, 2025

Conversation

JoanneBogart
Copy link
Collaborator

@JoanneBogart JoanneBogart commented Feb 27, 2025

Add a script for removal of "not null" constraint on dataset.relative_path. This entailed other supporting updates:

  • Make some changes to create_registry_schema.py so it uses new interface for DbConnection correctly in all cases (not sure all of it was necessary)
  • Extract _DB_VERSION_MAJOR and similar variables to a separate module so they can be used both by create_registry_schema and update-in-place scripts
  • Document procedure for making and testing update-db-in-place changes
  • Update ci to use new --sqlite option when invoking create_registry_schema

Copy link
Collaborator

@stuartmcalpine stuartmcalpine left a comment

Choose a reason for hiding this comment

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

Made a few notes

config_file=args.config,
schema=schema,
entry_mode=entry_mode,
query_mode=query_mode)
Copy link
Collaborator

Choose a reason for hiding this comment

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

entry_mode and query_mode are not needed when schema is set. I think this is was always true, however this is now explicitly set in my latest PR, where I try to make sure connecting to a schema vs namespace sets all the right things.

query_mode=query_mode)
print(f"Database dialect is '{db_connection.dialect}'")
if args.sqlite != (db_connection.dialect == "sqlite"):
raise ValueError("config and sqlite argument disagree")
Copy link
Collaborator

Choose a reason for hiding this comment

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

If this check can already be done using the dialect, then is the --sqlite flag needed? If this was only for the entry_mode and query_mode then its no longer needed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, it was for entry_mode and query_mode. It's true that, once DbConnection determines the dialect is sqlite, it can choose to ignore the modes and the namespace. And if the schema argument is used, DbConnection can set the modes to match that schema. But for sqlite there is no schema, so the schema argument to DbConnection can't be used. Although it might "just work" for the sqlite case, it's very unclear what's going on. At the very least there needs to be more explanation in the docstring for what happens in all these cases.

@@ -219,7 +219,7 @@ jobs:
# Create schema
- name: Create data registry default schema
run: |
python scripts/create_registry_schema.py --config $DATAREG_CONFIG
python scripts/create_registry_schema.py --config $DATAREG_CONFIG --sqlite
Copy link
Collaborator

Choose a reason for hiding this comment

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

See comment in create_registry_schema

# For location_type external or metadata_only, relative_path
# must be none
if kwargs_dict["location_type"] in ["external", "meta_only"]:
kwargs_dict["relative_path"] = None
Copy link
Collaborator

Choose a reason for hiding this comment

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

After _validate_register_inputs, back in the register function, there is the relative_path from name auto generation. As the relative_path gets set to None before then, is the auto generation then undoing this? (line 454 of register.py)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Indeed. That's what should be changed rather than _validate_register_inputs.
Will fix.

@@ -0,0 +1,62 @@
.. _maintenance
Copy link
Collaborator

Choose a reason for hiding this comment

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

Need to add this page to the index.rst toctree for it to appear in the docs

import os
import argparse
from sqlalchemy import text
from dataregistry.db_basic import DbConnection
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we list on the docs page a change log history of these kind of changes?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Perhaps. I didn't attempt to get this ready for a release (updating version, adding anything to CHANGELOG.md). With more than one person working in the repo I suspect it might be easier to manage if upgrades involving version changes are separated into two PRs:

  • code updates (maybe also change version to a value like 1.2.3rc1 so it's clear it's not a release?)
  • anything having specifically to do with release, which maybe is just setting version and adding to CHANGELOG.md

@JoanneBogart JoanneBogart force-pushed the u/jrbogart/in_place_mod branch from 9898fcf to 2cafd74 Compare March 7, 2025 23:29
Copy link
Collaborator

@stuartmcalpine stuartmcalpine left a comment

Choose a reason for hiding this comment

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

lgtm

@JoanneBogart JoanneBogart merged commit 13db5e0 into main Mar 12, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants