After reading more MySQL docs, I found I could run the following:

connection.query("SET storage_engine = InnoDB")

I run this before running .createTable on my SQLObject classes and it
works well.

Thanks for the responses.

/Brian/

On Fri, Nov 7, 2008 at 3:46 PM, David Turner <[EMAIL PROTECTED]> wrote:
> I think it will work to add the following to mysql/mysqlconnection.py:
>
>    def createTableSQL(self, soClass):
>        constraints = self.createReferenceConstraints(soClass)
>        extraSQL = self.createSQL(soClass)
>        createSql = ('CREATE TABLE %s (\n%s\n) engine=innodb' %
>                (soClass.sqlmeta.table, self.createColumns(soClass)))
>        return createSql, constraints + extraSQL
>
> It might make sense to do this globally, on the theory that it's what
> most people ought to want.  Else it appears that it would be easy to
> make it an option per-connection.  I don't know about per-table.
>
> On Fri, 2008-11-07 at 15:04 -0500, Brian Long wrote:
>> I'll admit I'm a newbie to SQLObject.  I understand MySQL only
>> supports cascade on delete using the InnoDB engine.  When I define a
>> class foreign key and specify "cascade=True", MySQL does not store
>> this because the default engine is MyISAM.
>>
>> Since the sqlmeta createSQL code gets run after table creation,
>> specifying "ALTER TABLE foo ENGINE InnoDB" runs after the foreign key
>> constraint was created.  This means I have to re-construct / re-add
>> the constraint inside createSQL.  Are there any better ways to
>> accomplish this?
>>
>> The SQLObject docs state:  "MySQL only supports transactions when
>> using the InnoDB backend, and SQLObject currently does not have
>> support for explicitly defining the backend when using createTable."
>> Are there any plans to change this in an upcoming release?  If I could
>> specify InnoDB for all created tables, the "cascade=True" attribute
>> would not get discarded by MySQL.
>>
>> Thanks.
>>
>> /Brian/

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to