kvesteri / sqlalchemy-continuum

Versioning extension for SQLAlchemy.
BSD 3-Clause "New" or "Revised" License
582 stars 125 forks source link

The documentation is unclear about native versioning's use of `temporary_transaction` table #114

Open ztane opened 8 years ago

ztane commented 8 years ago

The documentation is unclear about native versioning's use of temporary_transaction table. Furthermore, should the temporary_transaction table be missing, even no warning is emitted.

I am using (trying to use) SA-C'nuum with Pyramid / SQLAlchemy / zope.transaction extension, with make_versioned(options=dict(native_versioning=True)); Alembic autogeneration works, triggers are created correctly, but seemingly nothing creates the temporary_transaction implicitly. Took a while even to find out why nothing is being versioned.

The docs should be clarified about this. Furthermore, which SQLAlchemy event is supposed to trigger the creation of the temp table?

ztane commented 8 years ago

I looked into this again, and the transaction table does indeed have transactions, even though no changes are recorded.

I suspect this occurs because I am using alembic migrations with native versioning; the create_triggers of transaction.py is never called in that case.

ztane commented 8 years ago

I succeeded in creating the transaction table properly along with its trigger in an alembic migration with

conn = op.get_bind()
Transaction = foo.models.Base._decl_class_registry.get('Transaction')
Transaction.__table__.create(bind=conn)

instead of autogenerated alembic migration. This of course was not documented at all.