Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Version 9 (modified by jorge.vargas, 13 years ago) (diff)


MySQL Setup

See DataBaseInstalation

To Transaction or Not to Transaction

By default TurboGears uses Transactions (the rest of this page applies if you want to use MySQL with Transactions).

Kevin has added a hook that allows you to disable transactions in TurboGears. If you do not want TurboGears to manage trancstions do this:

1. Kevin Dangoor
	Dec 29, 11:54 am   show options
From: Kevin Dangoor <> - Find messages by this author
Date: Thu, 29 Dec 2005 11:54:25 -0500
Local: Thurs, Dec 29 2005 11:54 am
Subject: to the mysql users with rollback exceptions
Reply | Reply to Author | Forward | Print | Individual Message | Show original | Report Abuse

As of r417, if you put notrans_ in front of the DBURI, TurboGears will
silently ignore all begin/commit/rollback/end instructions.


If you want to use Transactions, read the rest of this page :-) Note that transactions is not the only reason why using InnoDB is a good idea. InnoDB also enforces data integrity much stricter than MyISAM and also has many more features.

Question: I tried changing my sqlobject.dburi from "mysql://..." to "notrans_mysql://..." but I found that it didn't work. I'm getting this traceback:

Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/TurboGears-0.9a0dev_r657-py2.4.egg/turbogears/toolbox/catwalk/", line 120, in __init__
  File "/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg/sqlobject/", line 1320, in createTable
    if ifNotExists and conn.tableExists(cls.sqlmeta.table):
AttributeError: 'NoneType' object has no attribute 'tableExists'


when the command:

tg-admin sql create

is issued, the default table type is used.

Mike summerized the options in an excellent email.

Mike Stephen
Dec 17, 5:17 pm   show options
From: "Mike Stephen" <> - Find messages by this author
Date: Sat, 17 Dec 2005 14:17:21 -0800
Local: Sat, Dec 17 2005 5:17 pm
Subject: Re: TurboGears, MySQL, Transactions, and InnoDB tables Oh My

Hi Mike,

I'm using MySQL with turbogears and they're working very nicely
together for me. What you need to do is to configure MySQL so that it
uses InnoDB as the default storage engine as Jonathan pointed out, so
that when you issue a create table statement, it'll be an InnoDB table
by default.

Do you have the MySQL Administrator GUI installed? If so, select
StartUp Variables from the left pane, then choose the General
Parameters tab. Down the bottom you'll see a Default Storage section.
Choose InnoDB from the drop-down.

Alternatively, you could add the following line to the [mysqld] section
of your my.ini file: