-
-
Notifications
You must be signed in to change notification settings - Fork 6
docs: 173 usage configuration #234
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
base: main
Are you sure you want to change the base?
Conversation
- 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.
…nto 173_usage_configuration
| with spec.provide_session(sqlite_db) as session: | ||
| session.execute("SELECT 1") | ||
|
|
||
| assert spec.configs[SqliteConfig].pool_config["database"] == tmp.name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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.
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>
Description
Closes
fixes #173