Yes it is possible to create SQLAlchemy models that work on both PostgreSQL and
SQLite. I've done it myself. It works ok for simple models and it is
relatively easy to mimic Postgres functions as SQLite UDFs.
However it will get harder if you need to use RETURNING queries or other
postgres go
Thank Mike for the input. My preliminary research on "Unit of work" has
shown it is exactly what I need. Still have to learn how to use it but
I'll get there. Again thanks.
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code,
Hey Simon,
Thanks so much for replying to my question. I reworked my code to use
sqlalchemy ORM and took off flask and paginate so I can narrow down the
issue. My models now extend from declarative_base.
engine =
create_engine('postgresql://postgres:postgres@localhost:5400/postgres')
Session
"paginate" is not an SQLAlchemy function, so you'd be better off
asking the author of whatever is providing that feature.
However, I would guess that maybe paginate is naively applying
something like "LIMIT 20" to the query. This doesn't work properly
when you join along a one-to-many relationship
Greetings,
My name is Alceu and this is my first post to this group and I'm a newbie
regarding SQLAlchemy.
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, eve