However it will get harder if you need to use RETURNING queries or other postgres goodies. You may be able to factor out an abstraction but too many of these and you're not really testing your production code any more.
So it depends on how what PostgreSQL goodies you feel you need.
I would also say that speeding up unit tests is normally possible especially if you lean heavily on native postgres mechanisms for loading fixtures and tearing them down. Stored procedures can be helpful with the teardown or save points.
Good luck!
Giles Brown
I have some projects that are using SQLAlchemy and PostgreSQL and they are running fine until we have to run automated tests that uses PostgreSQL and they took ~5 minutes to complete, even after trying to improve PostgreSQL configuration for better performance.
Those tests are meant to be executed locally, so SQLite (in memory) would be a much faster option.
The problem is, creating a model for the SQLite dialect results in something incompatible with PostgreSQL (I'm quite aware that their inner mechanisms are very different).Is it possible to generate models that could be compatible between the two databases systems, so I could switch from to another depending on the environment? Retaining data is not something required since all data created from the tests will be disposable anyway.