begin/commit's in DBAPI have no "statements" since there is really no "begin", and "commit" is an API level call.

also, all DBAPI connections have autocommit turned off by default. however, the engine is issuing an explicit "commit" call at the end of every execution, if you dont have a transaction in progress, so it has the effect of autocommit.

engine.begin() and engine.commit() will create a transaction and bypass the auto-committing behavior. im not exactly sure how that would "speed up" sqlite interaction? multiple writers with SQLite is going to be a slow performer with autocommit or not.

On Apr 17, 2006, at 2:32 AM, Michael Gechter wrote:

Sorry of this is a repost -- I sent it once before joining the list. I don't think it went through though...
---
Hello,

I've started using sqlalchemy a few weeks ago for a recent project. Right now I've version locked to 0.1.5 unless there's a compelling reason for me to move past that.

The database engine I'm using is sqlite. I haven't used sqlite before, so I don't know how much of my question is sqlite versus SA specific. Basically, I don't know how to start database transactions with autocommit turned off. I only found a couple of references to autocommit in the docs, but it didn't really suggest how to turn autocommit off. (do i pass this in to the create_engine function?)

As for the transactions themselves, engine.begin() should start one and engine.commit() should commit that transaction to the database. Is there a way to see these begin/commit/end statements echoed? I see the inserts, deletes, updates and creates just fine, but no transaction stuff.

As for why I want to use the db's transaction as opposed to the unit of work: My file-based sqlite database interaction is going very slow. I think this has to do with the fsync() call that sqlite makes. The benchmark sites suggest using transactions for all statements. Another option I'd be happy to is use the nosync option referred to by the benchmark sites, but I couldn't find any mention of that in the pysqlite2 source or documentation.

Sorry if this is too sqlite-centric but I was having trouble separating the interaction of the two in my mind.

-Michael Gechter


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel? cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to