How to start a transaction?

M.-A. Lemburg mal at egenix.com
Tue Jan 20 14:25:18 CET 2009


On 2009-01-20 12:23, Hussein B wrote:
> Hey,
> I know the basics of interacting with databases in Python.
> How to start a transaction in case I want to group a couple of insert
> and update statements into a single operation?

If you use a Python DB-API compatible database module, then
transactions are enabled per default after you connect to the
database. connection.commit() and .rollback() then complete a
transaction and implicitly start a new one.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Jan 20 2009)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try our new mxODBC.Connect Python Database Interface for free ! ::::


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/



More information about the Python-list mailing list