Skip to content

Conversation

@dimitri-yatsenko
Copy link
Member

@dimitri-yatsenko dimitri-yatsenko commented Jan 8, 2026

Summary

This PR adds comprehensive documentation for DataJoint's virtual schema infrastructure and CLI.

Virtual Schema Specification

reference/specs/virtual-schemas.md - Complete specification covering:

Core Concepts:

  • Schema-module convention: DataJoint's 1:1 mapping where modules represent schemas and classes represent tables
  • Table tier prefixes (#, _, __) and automatic detection

Schema Introspection API:

  • Schema.get_table(name) - Direct table access
  • Schema.__getitem__ - Bracket notation: schema['TableName']
  • Schema.__iter__ - Iterate tables in dependency order
  • Schema.__contains__ - Check table existence

Entry Points:

  • dj.virtual_schema(schema_name) - Access existing database schemas
  • dj.VirtualModule(alias, schema_name) - Create virtual modules with custom names
  • Schema.spawn_missing_classes() - Generate table classes dynamically

Use Cases:

  • Data exploration and ad-hoc queries
  • Cross-schema queries and joins
  • Schema migration and comparison
  • Garbage collection infrastructure

CLI How-To Guide

how-to/use-cli.md - Practical guide for the dj command:

Getting Started:

  • Starting the REPL with dj command
  • Specifying database credentials (--host, --user, --password)

Schema Loading:

  • Loading schemas as virtual modules (-s schema_name:alias)
  • Multiple schema loading for cross-schema exploration

Common Workflows:

  • Exploring existing schemas
  • Quick data checks
  • Testing database connections
  • Viewing schema diagrams

Reference:

  • All command-line options
  • Programmatic usage from Python
  • Entry points (dj and datajoint commands)

Related

  • Companion to datajoint-python PR #1313

🤖 Generated with Claude Code

dimitri-yatsenko and others added 2 commits January 8, 2026 14:05
Add comprehensive specification for virtual schema infrastructure:
- Schema-module convention (1:1 mapping)
- Schema introspection API (get_table, __getitem__, __iter__)
- dj.virtual_schema() function
- Table class generation
- Use cases and examples

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Create use-cli.md with comprehensive CLI documentation
- Cover database credentials, schema loading, common workflows
- Add to how-to index under Setup section

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Document persistent connection (singleton) vs context manager patterns
for different use cases (interactive vs serverless).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@dimitri-yatsenko dimitri-yatsenko merged commit cd5f96b into pre/v2.0 Jan 9, 2026
@dimitri-yatsenko dimitri-yatsenko deleted the virtual-modules branch January 9, 2026 18:43
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