Skip to content

Comment on Test Postgres in Python Like SQLite

Comments

This is running pglite in a node subprocess. Why not just run Postgres itself as a subprocess with a data directory in a tempdir?

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.

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.

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.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.