You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: highlight backend parameter (mysql/postgresql) in thread-safe spec
Add backend parameter to the Instance API table, document default ports
per backend, and show usage examples for MySQL, PostgreSQL, and custom
port configurations.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|`backend`|`str`| from config |`"mysql"` or `"postgresql"`|
32
33
|`**kwargs`| — | — | Config overrides (see below) |
33
34
35
+
#### Backend selection
36
+
37
+
The `backend` parameter selects the database engine. When set, it also determines the default port:
38
+
39
+
| Backend | Default port |
40
+
|---------|-------------|
41
+
|`"mysql"`| 3306 |
42
+
|`"postgresql"`| 5432 |
43
+
44
+
If `backend` is omitted, it defaults to `config.database.backend` (which itself defaults to `"mysql"` unless overridden by environment or config file). An explicit `port` always takes precedence over the backend default.
**Config overrides:** Any keyword argument that matches a config attribute is applied to the Instance's config. Use double underscores for nested settings:
config_override=inst.config) # use this config, not the global
170
199
```
171
200
172
201
When `config_override` is provided, the Connection uses it for all config reads (port, charset, reconnect, query cache, etc.). When omitted, it falls back to the module-level `settings.config`.
173
202
174
-
When `backend` is provided, it is used directly. When omitted, the backend is read from `self._config["database.backend"]`.
203
+
When `backend` is provided, it selects the database adapter directly (`"mysql"` → `pymysql`, `"postgresql"` → `psycopg`). When omitted, the backend is read from `self._config["database.backend"]` (default: `"mysql"`).
0 commit comments