Skip to content

Add a working, more complete example of using a catalog (docs)#1427

Open
toppyy wants to merge 4 commits intoapache:mainfrom
toppyy:docs_catalog_example
Open

Add a working, more complete example of using a catalog (docs)#1427
toppyy wants to merge 4 commits intoapache:mainfrom
toppyy:docs_catalog_example

Conversation

@toppyy
Copy link

@toppyy toppyy commented Mar 13, 2026

Which issue does this PR close?

There's is no outstanding issue.

Rationale for this change

The docs have non-working/incomplete example for using the Catalog. SessionContext does not have a method register_catalog. Also, ctx is not defined for example.

The default schema name for SessionContext is not "default", but "public".

What changes are included in this PR?

A working example of using the catalog and accessing it is added. Some of the language is worked as the original statement is now evident in the example.

Changed the default schema name to "public" instead of "default".

Are there any user-facing changes?

The documentation is updated.

Copy link
Contributor

@kevinjqliu kevinjqliu left a comment

Choose a reason for hiding this comment

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

LGTM! a few minor nits

is there a way to render it locally to see if the formatting looks good?

:py:class:`~datafusion.catalog.Schema`, and :py:class:`~datafusion.catalog.Table`. By default,
a :py:class:`~datafusion.context.SessionContext` comes with a single Catalog and a single Schema
with the names ``datafusion`` and ``default``, respectively.
with the names ``datafusion`` and ``public``, respectively.
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 verified locally

uv run --with datafusion python3 -c "
from datafusion import SessionContext
ctx = SessionContext()
print('Catalog names:', ctx.catalog_names())
catalog = ctx.catalog('datafusion')
print('Schema names:', catalog.names())
"

Catalog names: {'datafusion'}
Schema names: {'public'}

toppyy and others added 2 commits March 19, 2026 19:04
Co-authored-by: Kevin Liu <kevinjqliu@users.noreply.github.com>
@toppyy
Copy link
Author

toppyy commented Mar 19, 2026

I used uv run --no-project docs/build.sh && firefox docs/build/html/index.html to render and check locally.

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