File tree Expand file tree Collapse file tree 2 files changed +10
-20
lines changed Expand file tree Collapse file tree 2 files changed +10
-20
lines changed Original file line number Diff line number Diff line change @@ -361,23 +361,18 @@ In this example we demonstrate how to create a basic configuration that integrat
361361# ///
362362
363363from litestar import Litestar, get
364-
364+ from sqlspec import SQLSpec
365365from sqlspec.adapters.aiosqlite import AiosqliteConfig, AiosqliteDriver
366- from sqlspec.extensions.litestar import DatabaseConfig, SQLSpec
367-
366+ from sqlspec.extensions.litestar import SQLSpecPlugin
368367
369368@get (" /" )
370369async def simple_sqlite (db_session : AiosqliteDriver) -> dict[str , str ]:
371370 return await db_session.select_one(" SELECT 'Hello, world!' AS greeting" )
372371
373372
374- sqlspec = SQLSpec(
375- config = DatabaseConfig(
376- config = AiosqliteConfig(pool_config = {" database" : " :memory:" }), # built in local pooling
377- commit_mode = " autocommit"
378- )
379- )
380- app = Litestar(route_handlers = [simple_sqlite], plugins = [sqlspec])
373+ sqlspec = SQLSpec()
374+ sqlspec.add_config(AiosqliteConfig(pool_config = {" database" : " :memory:" }))
375+ app = Litestar(route_handlers = [simple_sqlite], plugins = [SQLSpecPlugin(sqlspec)])
381376```
382377
383378## Inspiration and Future Direction
Original file line number Diff line number Diff line change @@ -361,23 +361,18 @@ In this example we demonstrate how to create a basic configuration that integrat
361361# ///
362362
363363from litestar import Litestar, get
364-
364+ from sqlspec import SQLSpec
365365from sqlspec.adapters.aiosqlite import AiosqliteConfig, AiosqliteDriver
366- from sqlspec.extensions.litestar import DatabaseConfig, SQLSpec
367-
366+ from sqlspec.extensions.litestar import SQLSpecPlugin
368367
369368@get (" /" )
370369async def simple_sqlite (db_session : AiosqliteDriver) -> dict[str , str ]:
371370 return await db_session.select_one(" SELECT 'Hello, world!' AS greeting" )
372371
373372
374- sqlspec = SQLSpec(
375- config = DatabaseConfig(
376- config = AiosqliteConfig(pool_config = {" database" : " :memory:" }), # built in local pooling
377- commit_mode = " autocommit"
378- )
379- )
380- app = Litestar(route_handlers = [simple_sqlite], plugins = [sqlspec])
373+ sqlspec = SQLSpec()
374+ sqlspec.add_config(AiosqliteConfig(pool_config = {" database" : " :memory:" }))
375+ app = Litestar(route_handlers = [simple_sqlite], plugins = [SQLSpecPlugin(sqlspec)])
381376```
382377
383378## Inspiration and Future Direction
You can’t perform that action at this time.
0 commit comments