GithubHelp home page GithubHelp logo

when autocommit isolation mode used, rollback at transaction level is not resulting in rollback of continuum transactions about sqlalchemy-continuum HOT 7 CLOSED

chicco785 avatar chicco785 commented on July 17, 2024
when autocommit isolation mode used, rollback at transaction level is not resulting in rollback of continuum transactions

from sqlalchemy-continuum.

Comments (7)

marksteward avatar marksteward commented on July 17, 2024

Does this only affect SQLAlchemy 1.4 or above in future mode? Can you share some code to reproduce it?

from sqlalchemy-continuum.

chicco785 avatar chicco785 commented on July 17, 2024

I am currently using SQLAlchemy 2.0 and continuum 1.4 version, i will try to provide you a minimal snipped of code to demo it (i need to extract it from my code)

from sqlalchemy-continuum.

marksteward avatar marksteward commented on July 17, 2024

Also which DBMS are you using? I don't really understand what rollback for autocommit would even mean.

from sqlalchemy-continuum.

chicco785 avatar chicco785 commented on July 17, 2024

i am testing it with 3 databases:

  • SQLite
  • MySQL
  • PostgreSQL

All exhibit the same issue, so it's not related to a specific dbms. You can enable autocommit isolation level (for psql and sqlite, for mysql is a bit more tricky) as follows:

engine = create_engine("postgresql+pg8000://postgres:postgres@localhost:5432/test")
connection = engine.connect()
connection.execution_options(isolation_level="AUTOCOMMIT")
transaction = connection.begin()
session = Session(bind=connection)

then, if instead of committing the transaction, you roll it back:

session.close()
# roll back the broader transaction
transaction.rollback()
# put back the connection to the connection pool
connection.close()

while changes to my tables are correctly rolled back, transactions table created by continuum is still populated with transactions that actually never occurred, since we rolled them back.

from sqlalchemy-continuum.

marksteward avatar marksteward commented on July 17, 2024

connection.begin should be a no-op under isolation_level="AUTOCOMMIT". You should see warnings in the logs to say so.

from sqlalchemy-continuum.

marksteward avatar marksteward commented on July 17, 2024

I'm guessing you don't actually need autocommit semantics, but if you do, have a look at the native versioning plugin.

from sqlalchemy-continuum.

chicco785 avatar chicco785 commented on July 17, 2024

thx

from sqlalchemy-continuum.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.