Repository navigation
Commit c93db0e
fix(test): execute migration scripts via raw asyncpg connection
test_forward_then_rollback_restores_baseline reached a live Postgres for
the first time after the MissingGreenlet fix, surfacing a second real bug:
SQLAlchemy's asyncpg dialect always executes through prepared statements,
and Postgres's extended query protocol rejects multiple SQL commands in a
single prepared statement -- every migration file here is multi-statement
DDL. conn.execute(text(sql)) failed with
"PostgresSyntaxError: cannot insert multiple commands into a prepared
statement" for every migration, then cascaded into unrelated test failures
(event-loop-closed noise) later in the same CI run.
Added _exec_script(), which runs the script through
conn.get_raw_connection().driver_connection.execute(sql) -- the raw asyncpg
connection's simple query protocol, which has no such restriction.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent 7516eb0 commit c93db0e
1 file changed
Lines changed: 14 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
342 | 342 | | |
343 | 343 | | |
344 | 344 | | |
345 | | - | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
346 | 350 | | |
347 | | - | |
348 | | - | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
349 | 358 | | |
350 | 359 | | |
351 | 360 | | |
352 | 361 | | |
353 | 362 | | |
354 | 363 | | |
355 | 364 | | |
356 | | - | |
| 365 | + | |
357 | 366 | | |
358 | 367 | | |
359 | 368 | | |
| |||
366 | 375 | | |
367 | 376 | | |
368 | 377 | | |
369 | | - | |
| 378 | + | |
370 | 379 | | |
371 | 380 | | |
372 | 381 | | |
| |||
0 commit comments