Pyramid SQLAlchemy database changes disappear on reload

I just started building my webapp, working from the pyramid tutorials.

When I add an item to my database, it gets persisted correctly, but when I change something in pyramid and need to restart the server

$VENV/bin/pserve development.ini --reload

all my changes are lost. Does anyone know why this happens?

I changed the script to build a demo database, and changed the sessionmaker to

session = scoped_session(sessionmaker(extension=ZopeTransactionExtension('changed')))

I've tried session.commit() and session.flush(), with no luck.


You're supposed to also have the pyramid_tm (transaction manager) configured; it is the one that actually commits the changes. Now it seems like you're not committing the changes / are just reusing the same dirty uncommitted session from request to another.

E.g. if you follow the wiki2, it assumes that you created the minimal project with pcreate using the alchemy scaffold.

In any case, make sure that the development.ini that you're using contains

pyramid.includes =
    pyramid_tm                 <--- this here

Need Your Help

How to perform cross join on datatables

c# datatable cross-join

i am to perform cross join (many to many relation) on datatables ( table1 X table2 X table3 X n tables).