Giter Site home page Giter Site logo

Comments (1)

mwatts15 avatar mwatts15 commented on June 8, 2024 1

A transaction is committed in all of the methods. We call Engine.begin() and pass to a context manager.

We use the 1.4 "legacy" API where the, now deprecated, nesting of begin()/commit() is possible. So, you can get the SQLArchemy engine from the store (or you could have passed it in to the Store's __init__) and call begin() around whatever calls to the store you want. So that changes the transaction boundary.

I think by "avoiding" transactions you mean not calling commit() within the transaction within the Store methods. (My understanding of the Python DB API is that you start a transaction when you execute anything if there isn't already one in progress.) Honestly, I prefer not actually managing the transaction within the store since it becomes complicated to manage when you need the transaction boundary to be broader than the Store can manage (e.g., committing after formatting a response to a web request). I haven't taken up that change since I became maintainer, but, as always, PRs with tests are welcome.

The SQLAlchemy store doesn't implement commit(), so it doesn't do anything if you call it.

SQLAlchemy transactions reference: https://docs.sqlalchemy.org/en/14/core/connections.html?highlight=connect#using-transactions

from rdflib-sqlalchemy.

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.