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
{{ message }}
Repository navigation
Commit 38fa59c
Browse filesBrowse the repository at this point in the historyBrowse files
fix: review findings before 0.5.0, bump to 0.5.0-beta.2
AsyncTransaction.__aexit__ now delegates to Transaction.__exit__, so a
manual commit or rollback inside an async with block no longer raises on
exit or replaces the block's own exception.
Transaction.rollback() is a no-op once the transaction has ended, and a
failed commit() leaves the transaction active, so the documented
except: tx.rollback(); raise handler never hides the real error.
Database.open(':memory:') gives each open a private in-memory database;
memory://name keeps the shared one. A DSN with any scheme is passed to
the engine untouched instead of becoming a relative directory named
after the scheme. open() defaults to ':memory:' and releases the GIL,
as does prepare().
execute_batch accepts any iterable of parameter sets, not only a list.
Type stubs gain Vector, the four *_prepared methods on Transaction and
AsyncTransaction, and the open() default.
CI and publish build wheels for CPython 3.9 through 3.13 instead of 3.12
only, CI tests 3.9, 3.12 and 3.13, and a pre-release tag creates a
pre-release on GitHub.
Copy file name to clipboardExpand all lines: README.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,6 +55,10 @@ raw = db.query_raw("SELECT id, name FROM users ORDER BY id")
55
55
db.close()
56
56
```
57
57
58
+
Each `Database.open(":memory:")` is a private database. To share one in-memory database between opens in the same process, give it a name: `Database.open("memory://name")`.
59
+
60
+
`query()` and `query_one()` key each row by column name, so two result columns with the same name (for example `a.id` and `b.id` in a join) collapse into one key. Alias them, or use `query_raw()`, when that matters.
61
+
58
62
## Prepared Statements
59
63
60
64
Parse SQL once, execute many times with different parameters:
@@ -99,7 +103,7 @@ except:
99
103
raise
100
104
```
101
105
102
-
Transactions support `execute()`, `query()`, `query_one()`, `query_raw()`, and `execute_batch()` with both positional (`$1, $2`) and named (`:key`) parameters.
106
+
Transactions support `execute()`, `query()`, `query_one()`, `query_raw()`, and `execute_batch()` with both positional (`$1, $2`) and named (`:key`) parameters. A statement prepared on the database runs inside a transaction with `execute_prepared(stmt, params)`, `query_prepared`, `query_one_prepared` and `query_raw_prepared`. `rollback()` is a no-op once the transaction has ended, so the handler above never hides the original error.
0 commit comments