Re:Test Postgres in Python Like SQLite
by laurencerowe on Friday June 06, 2025 @01:03AM
(#44197945)
This is running pglite in a node subprocess. Why not just run Postgres itself as a subprocess with a data directory in a tempdir?
[ Parent
| on HN ]
I think the ultimate version in such use case would be carefully wire-up the baremetal one with ad-hoc in-mem-disk or tempdir :), this could be a future backend of py-pglite(planned in v2).
For now, it's more accessible for me to hack it in hours and it works.
Re:Test Postgres in Python Like SQLite
by laurencerowe on Sunday June 08, 2025 @01:20AM
(#44214705)
It might be more interesting to try and get the wasm running directly within Python so you don't need a subprocess and all the coordination involved with that.
Re:Test Postgres in Python Like SQLite
by isoprophlex on Friday June 06, 2025 @01:35AM
(#44198072)
Exactly; in the past I've had reasonable success with test fixtures based on temp dirs and a templated docker compose file. Just needs docker in the environment, which is not too far fetched.