@@ -218,32 +218,12 @@ The ``--config`` option accepts a dotted path to either:
218218
219219Example configuration file (``myapp/config.py ``):
220220
221- .. code-block :: python
222-
223- from sqlspec.adapters.asyncpg import AsyncpgConfig
224-
225- # Single config
226- db_config = AsyncpgConfig(
227- pool_config = {" dsn" : " postgresql://user:pass@localhost/mydb" },
228- migration_config = {
229- " script_location" : " migrations" ,
230- " enabled" : True
231- }
232- )
233-
234- # Multiple configs
235- configs = [
236- AsyncpgConfig(
237- bind_key = " postgres" ,
238- pool_config = {" dsn" : " postgresql://..." },
239- migration_config = {" script_location" : " migrations/postgres" }
240- ),
241- # ... more configs
242- ]
243-
244- # Callable function
245- def get_configs ():
246- return [db_config]
221+ .. literalinclude :: /examples/usage/usage_cli_1.py
222+ :language: python
223+ :dedent: 0
224+ :start-after: # start-example
225+ :end-before: # end-example
226+ :caption: `configuration loading `
247227
248228Global Options
249229--------------
@@ -769,29 +749,12 @@ them collectively or selectively.
769749Scenario: Multiple Databases
770750-----------------------------
771751
772- .. code-block :: python
773-
774- # config.py
775- from sqlspec.adapters.asyncpg import AsyncpgConfig
776- from sqlspec.adapters.asyncmy import AsyncmyConfig
777-
778- configs = [
779- AsyncpgConfig(
780- bind_key = " postgres" ,
781- pool_config = {" dsn" : " postgresql://..." },
782- migration_config = {" script_location" : " migrations/postgres" , " enabled" : True }
783- ),
784- AsyncmyConfig(
785- bind_key = " mysql" ,
786- pool_config = {" host" : " localhost" , " database" : " mydb" },
787- migration_config = {" script_location" : " migrations/mysql" , " enabled" : True }
788- ),
789- AsyncpgConfig(
790- bind_key = " analytics" ,
791- pool_config = {" dsn" : " postgresql://analytics/..." },
792- migration_config = {" script_location" : " migrations/analytics" , " enabled" : True }
793- ),
794- ]
752+ .. literalinclude :: /examples/usage/usage_cli_2.py
753+ :language: python
754+ :dedent: 0
755+ :start-after: # start-example
756+ :end-before: # end-example
757+ :caption: `multiple databases `
795758
796759Upgrade All Enabled Configs
797760----------------------------
0 commit comments