fix: host/port defaults no longer shadow a dsn's embedded host/port (psql-5)
Signed-off-by: disqualifier <dev@disqualifier.me>
This commit is contained in:
@@ -10,18 +10,18 @@ a sibling of the `mongo` lib. Class is **`PsqlDB`**.
|
||||
`requirements.txt`:
|
||||
|
||||
```
|
||||
psql @ git+ssh://git@git.rethinkstudios.io/rethink-public/psql.git@v0.1.3
|
||||
psql @ git+ssh://git@git.rethinkstudios.io/rethink-public/psql.git@v0.1.4
|
||||
```
|
||||
|
||||
Direct:
|
||||
|
||||
```bash
|
||||
pip install "psql @ git+ssh://git@git.rethinkstudios.io/rethink-public/psql.git@v0.1.3"
|
||||
pip install "psql @ git+ssh://git@git.rethinkstudios.io/rethink-public/psql.git@v0.1.4"
|
||||
```
|
||||
|
||||
Pulls `asyncpg`.
|
||||
|
||||
Drop the `@v0.1.3` suffix from the line above to install the latest unpinned.
|
||||
Drop the `@v0.1.4` suffix from the line above to install the latest unpinned.
|
||||
|
||||
## The two-layer API
|
||||
|
||||
@@ -63,6 +63,12 @@ async with PsqlDB(database="app", user="postgres") as db:
|
||||
await db.insert("events", {"kind": "login"})
|
||||
```
|
||||
|
||||
`host`/`port` default to `None`, not `"localhost"`/`5432` — asyncpg only reads a `dsn`'s
|
||||
embedded host/port when the `host`/`port` kwargs are falsy, so passing `dsn=...` in
|
||||
`pool_kwargs` (with no `host`/`port` of your own) lets the dsn's server reach asyncpg
|
||||
instead of being silently overridden. The no-dsn path above still defaults to
|
||||
`localhost:5432` when you don't pass `host`.
|
||||
|
||||
### Layer 2 — raw SQL for the complex queries
|
||||
|
||||
```python
|
||||
|
||||
Reference in New Issue
Block a user