Skip to content

Conversation

@euri10
Copy link
Collaborator

@euri10 euri10 commented Nov 5, 2025

Description

Closes

fixes #173

- Added docs/examples/usage/test_configuration_22.txt with migration CLI commands

- Replaced inline Migration CLI block in docs/usage/configuration.rst with a literalinclude to the new file

- Inserted psycopg literalinclude in docs/usage/configuration.rst (reusing examples/usage/test_configuration_5.py)

- Updated documentation TODOs accordingly

Signed-off-by: euri10 <benoit.barthelet@gmail.com>
This reverts commit 0ff5c15.
@euri10 euri10 changed the title 173 usage configuration docs: 173 usage configuration Nov 5, 2025
with spec.provide_session(sqlite_db) as session:
session.execute("SELECT 1")

assert spec.configs[SqliteConfig].pool_config["database"] == tmp.name
Copy link
Member

@cofin cofin Nov 5, 2025

Choose a reason for hiding this comment

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

Suggested change
assert spec.configs[SqliteConfig].pool_config["database"] == tmp.name
assert spec.configs[sqlite_db].pool_config["database"] == tmp.name

If the user has multiple configs of the same type, this is the way to make it find the correct config. Otherwise, it'll just return the first config that match the class type.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this syntax just doesnt work, either i uncovered a bug but I made the change secifically to use SqliteConfig because the lookup doenst work

with spec.provide_session("cache_db") as session:
session.execute("SELECT 1")

assert spec.configs[SqliteConfig].pool_config["database"] == tmp.name
Copy link
Member

Choose a reason for hiding this comment

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

It might be good to leave a few like this to show this method, but it's up to you.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

actually i think this is the first bug i find, i dont think you can get the session by bind_key or it doesnt work as intended

"session_key": "db_session",
"pool_key": "db_pool",
"commit_mode": "autocommit",
"enable_correlation_middleware": True,
Copy link
Member

Choose a reason for hiding this comment

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

@euri10 i meant to bring this up you and @provinzkraut. I've removed it from sqlspec, but I think it needs to be something we include as an official middleware in Litestar. This will let us and others leverage the a correlation ID in their logs. I can add it back here if it's something we don't want in Litestar.

cofin and others added 4 commits November 5, 2025 16:40
Co-authored-by: Cody Fincher <204685+cofin@users.noreply.github.com>
Co-authored-by: Cody Fincher <204685+cofin@users.noreply.github.com>
Co-authored-by: Cody Fincher <204685+cofin@users.noreply.github.com>
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.

docs: test ./usage/configuration.rst

2 participants