-
Notifications
You must be signed in to change notification settings - Fork 93
feat: virtual schema infrastructure and CI improvements #1313
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Update test_top_restriction_with_keywords to verify that dj.Top properly preserves ordering in fetch results. Use secondary sort by 'id' to ensure deterministic results when there are ties. Fixes #1205 Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add Schema.get_table() for direct table access - Add Schema.__getitem__ for bracket notation: schema['TableName'] - Add Schema.__iter__ to iterate over all tables - Add Schema.__contains__ for 'TableName' in schema - Add dj.virtual_schema() as clean entry point - Remove create_virtual_module (breaking change) - Fix gc.py to use get_table() instead of spawn_table() - Remove specs/ folder (moved to datajoint-docs) - Add comprehensive tests for virtual schema infrastructure Fixes #1307 Co-Authored-By: Claude Opus 4.5 <[email protected]>
The pre-commit config has been modernized to use ruff instead of flake8. Update the SKIP example comment accordingly. Closes #1271 Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add type annotations to errors.py (suggest method) - Add type annotations to hash.py (key_hash, uuid_from_buffer) - Enable strict mypy checking for these modules - Now 3 modules under strict checking: content_registry, errors, hash Increases type coverage incrementally following gradual adoption strategy. Related #1266 Co-Authored-By: Claude Opus 4.5 <[email protected]>
Change sync-labels from true to false in PR labeler workflow. This prevents the GitHub Actions labeler from removing manually added labels like "breaking" when they don't match the automatic labeling rules. With sync-labels: true, the action removes any labels not matched by the configuration. With sync-labels: false, it only adds labels based on patterns and preserves manually added labels. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Update PyPI keywords to reflect DataJoint 2.0 positioning and modern data engineering terminology: Added: - data-engineering, data-pipelines, workflow-management - data-integrity, reproducibility, declarative - object-storage, schema-management, data-lineage - scientific-computing, research-software - postgresql (upcoming support) Removed: - Generic terms: database, automated, automation, compute, data - Redundant terms: pipeline, workflow, scientific, science, research - Domain-specific: bioinformatics (kept neuroscience as primary) Updated GitHub repository topics to match (18 topics total). Focuses on searchable terms, 2.0 features, and differentiators. Co-Authored-By: Claude Opus 4.5 <[email protected]>
The get_table(), __getitem__, and __contains__ methods now auto-detect
table tier prefixes (Manual: none, Lookup: #, Imported: _, Computed: __).
This allows users to access tables by their base name without knowing
the tier prefix:
- schema.get_table("experiment") finds "_experiment" (Imported)
- schema["Subject"] finds "#subject" (Lookup)
- "Experiment" in schema returns True
Added _find_table_name() helper that checks exact match first, then
tries each tier prefix.
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Replace deprecated fetch() calls with to_dicts() in test_virtual_module.py: - test_virtual_schema_tables_are_queryable: use lab.Experiment().to_dicts() - test_getitem_is_queryable: use table.to_dicts() Co-Authored-By: Claude Opus 4.5 <[email protected]>
The create_virtual_module function was removed in 2.0. Update the CLI to use dj.virtual_schema() for loading schemas via the -s flag. Co-Authored-By: Claude Opus 4.5 <[email protected]>
VirtualModule allows specifying both module name and schema name, while virtual_schema() uses schema name for both. The CLI needs custom module names for the -s flag, so use VirtualModule directly. Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Remove -h shorthand for --host (conflicts with argparse --help) - Add module-level docstring with usage examples - Improve function docstring with NumPy style - Add explicit error handling for invalid schema format - Improve banner message with version and usage hint - Use modern type hints (list[str] | None) - Fix locals() issue: explicitly include dj in REPL namespace Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Replace -h shorthand with --host (removed to avoid -h/--help conflict) - Use separate arguments instead of concatenated form - Use prefix variable for schema name consistency - Fix assertion string matching Co-Authored-By: Claude Opus 4.5 <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
breaking
Not backward compatible changes
documentation
Issues related to documentation
enhancement
Indicates new improvements
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR modernizes DataJoint's schema exploration capabilities with a complete virtual schema infrastructure overhaul and CLI improvements.
Virtual Schema Infrastructure (#1307)
New Schema Introspection API:
Schema.get_table(name)- Direct table access with automatic tier prefix detectionSchema.__getitem__- Bracket notation:schema['TableName']Schema.__iter__- Iterate over all tables in dependency orderSchema.__contains__- Check table existence:'TableName' in schemaNew Entry Points:
dj.virtual_schema(schema_name)- Clean function to access existing database schemasdj.VirtualModule(alias, schema_name)- Create virtual modules with custom namesInternal Fixes:
gc.pyto useget_table()instead of non-existentspawn_table()#,_,__) automatically in table lookupsCLI Improvements
The
djcommand-line interface now provides a proper interactive REPL for schema exploration:Bug Fixes:
-hconflict: removed-hshorthand for--host(was overriding--help)djin REPLEnhancements:
schema:aliasvalidation)Usage:
Empty Insert Support (#1280)
Tables with all-default attributes now accept empty inserts:
CI/Tooling (#1271)
Other Fixes
dj.Topto preserve ORDER BY in results (Test fails in relational_operand due to test code, not functionality. #1205)Breaking Changes
create_virtual_module- usedj.virtual_schema()ordj.VirtualModule()insteadspecs/folder (migrated to datajoint-docs)Test Plan
test_virtual_module.py)get_table,__getitem__,__iter__,__contains__test_insert.py::TestEmptyInsert)dj.Topordering test updatedCloses
super.deletekwargs toPart.delete#1276 (Part.delete kwargs pass-through)🤖 Generated with Claude Code