Add examples/session: canonical patterns for sessions, catalogs, providers, and extensions#33
Conversation
…providers, and extensions - session_basics: explicit session, context manager, global helpers - session_providers: global/custom-endpoint/named/multi-provider patterns - session_catalogs: in-memory catalog, attach, create/temp tables, existence checks - session_sql: SELECT, DISTINCT, JOIN, temp-table queries via sess.sql() - session_namespaces: create/use/drop namespaces, Identifier, pattern listing - session_context_config: execution config, planning config, scoped context managers - session_extension_h3: load_extension() with daft-h3 for H3 geospatial indexing All scripts tested green; registered in tests/registry.py. Added daft-h3 to project dependencies. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 135acec0cd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| def pattern_filtered_listing(sess: Session) -> None: | ||
| """Filter catalog listings with a glob pattern.""" | ||
| sess.list_tables("sales.*") |
There was a problem hiding this comment.
Use SQL LIKE pattern for list_tables filtering
Session.list_tables() on the in-memory catalog expects SQL LIKE syntax (%, _), but this example passes a glob pattern ("sales.*"). In this context * is treated literally, so the filter won’t match sales.orders/sales.customers and the demo silently fails to show namespace-scoped listing. Use a LIKE pattern such as "sales.%" so the function behaves as described.
Useful? React with 👍 / 👎.
Print active provider name, has_provider checks, and detach confirmation for functions that don't otherwise produce output. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Print namespace/table listings, active namespace before/after set, identifier parts, existence check results, and state after drops. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- session_catalogs: print has_catalog/has_table results in existence_checks - session_context_config: print config values after enable_dynamic_batching, fine_tuned_execution_config, and enable_strict_filter_pushdown Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
examples/session/with 7 focused example scripts covering the full Daft session API surface__main__calls them in sequencetests/registry.pydaft-h3to project dependenciesScripts
session_basics.pysession_providers.pysession_catalogs.pysession_sql.pydaft.sql(), temp-table joinssession_namespaces.pyIdentifier, pattern-filtered listingsession_context_config.pysession_extension_h3.pyload_extension()withdaft-h3: lat/lng→cells, hex↔UInt64, inspect, parent rollup, grid distanceTest plan
session_basics.py— passessession_catalogs.py— passessession_namespaces.py— passessession_sql.py— passessession_context_config.py— passes (reads public S3)session_providers.py— passes (requiresOPENAI_API_KEY)session_extension_h3.py— passes (requiresdaft-h3)🤖 Generated with Claude Code