File tree Expand file tree Collapse file tree 3 files changed +25
-9
lines changed Expand file tree Collapse file tree 3 files changed +25
-9
lines changed Original file line number Diff line number Diff line change 11"""Test configuration example: Best practice - Tune pool sizes."""
22
3+
34def test_disable_security_checks_best_practice () -> None :
45 """Test disabling security checks when necessary."""
56
Original file line number Diff line number Diff line change 1- import pytest
2-
3-
4- @pytest .mark .skip (reason = "PsycopgConfig does not exist in the codebase." )
51def test_psycopg_config_setup () -> None :
6- pass
2+ from sqlspec .adapters .psycopg import PsycopgAsyncConfig
3+
4+ # Async version
5+ config = PsycopgAsyncConfig (
6+ pool_config = {
7+ "conninfo" : "postgresql://user:pass@localhost/db" ,
8+ # Or keyword arguments:
9+ "host" : "localhost" ,
10+ "port" : 5432 ,
11+ "dbname" : "mydb" ,
12+ "user" : "myuser" ,
13+ "password" : "mypassword" ,
14+ # Pool settings
15+ "min_size" : 5 ,
16+ "max_size" : 10 ,
17+ "timeout" : 30.0 ,
18+ }
19+ )
20+ assert config .pool_config is not None
Original file line number Diff line number Diff line change @@ -58,10 +58,11 @@ PostgreSQL Configuration (asyncpg)
5858PostgreSQL Configuration (psycopg)
5959^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6060
61- .. note ::
62-
63- The `PsycopgConfig ` class referenced here is for documentation purposes only and may not be present in the codebase. Future releases may include this feature if demand warrants.
64-
61+ .. literalinclude :: /examples/usage/test_configuration_5.py
62+ :language: python
63+ :caption: `psycopg async configuration `
64+ :lines: 2-19
65+ :dedent: 2
6566
6667MySQL Configuration (asyncmy)
6768^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You can’t perform that action at this time.
0 commit comments