Porting BugFix #3615 (Can't define forward references in fixtures using MySQL with InnoDB) to Django 1.3.1
Hey, If you get this problem with your fixtures when loading them into MySQL InnoDB, you can use this forked branch of Django: https://github.com/kipanshi/django/tree/1.3.1.1 To install via pip: pip install -e git+git://github.com/kipanshi/ django.git@1.3.1.1#egg=django-1.3.1.1 -- Cheers, Ki -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: MySQL and InnoDB
On Aug 7, 6:50 pm, Rob Hudson <[EMAIL PROTECTED]> wrote: > > Can you get the same result with "default-storage-engine=InnoDB" in your > > my.cnf? > > I believe you can but for other various reasons I'm not able to make > this change globally. You can let django create myisam tables, and convert them with one line of shell: for t in $(mysql --batch -e "show tables" mydb |grep -v Tables_in); do mysql -e "alter table $t engine=innodb" mydb; done Of course, then you need to add foreign key constraints by hand, but it's pretty easy to do, and you get more control on ON CASCADE / ON DELETE statements. Ludo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: MySQL and InnoDB
On 8/8/07, Rob Hudson <[EMAIL PROTECTED]> wrote: > > On Aug 6, 4:16 am, Matti Haavikko <[EMAIL PROTECTED]> wrote: > > Hi, > > > > Can you get the same result with "default-storage-engine=InnoDB" in your > > my.cnf? > > > > - Haavikko > > I believe you can but for other various reasons I'm not able to make > this change globally. > > Does anyone know if adding the DATABASE_OPTIONS config setting adds > any unneeded overhead? init_command is run every time a connection is established through MySQLdb.connection.Connection() so anything you put into init_command will be executed each time a connection is made to the database. "SET storage_engine=INNODB" would be "unneeded overhead" under normal circumstances since it sets a system variable that only affects table creation. This is why the docs say that you remove init_command from DATABASE_OPTIONS once you have created your tables. -- _nimrod_a_abing_ http://abing.gotdns.com/ http://www.preownedcar.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: MySQL and InnoDB
On Aug 6, 4:16 am, Matti Haavikko <[EMAIL PROTECTED]> wrote: > Hi, > > Can you get the same result with "default-storage-engine=InnoDB" in your > my.cnf? > > - Haavikko I believe you can but for other various reasons I'm not able to make this change globally. Does anyone know if adding the DATABASE_OPTIONS config setting adds any unneeded overhead? Thanks, Rob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: MySQL and InnoDB
Hi, Can you get the same result with "default-storage-engine=InnoDB" in your my.cnf? - Haavikko Rob Hudson wrote: > Hi Django Users, > > I'm using MySQL with Django but I dislike MySQL's default MyISAM > tables because there is no referential integrity. So I googled how to > force Django to create InnoDB tables with MySQL and I found that I > need to add this to my settings.py: > > DATABASE_OPTIONS = { >"init_command": "SET storage_engine=INNODB", > } > > I also saw that there was a comment stating to only do this when you > run syncdb and not when running in general. I can understand that > it's only really needed when you run the CREATE statements, but does > anyone know if it adds any overhead if it's left in? It's somewhat of > a PITA to have to remember to alter my settings if I'm adjusting my > data models. > > Thanks, > Rob > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
MySQL and InnoDB
Hi Django Users, I'm using MySQL with Django but I dislike MySQL's default MyISAM tables because there is no referential integrity. So I googled how to force Django to create InnoDB tables with MySQL and I found that I need to add this to my settings.py: DATABASE_OPTIONS = { "init_command": "SET storage_engine=INNODB", } I also saw that there was a comment stating to only do this when you run syncdb and not when running in general. I can understand that it's only really needed when you run the CREATE statements, but does anyone know if it adds any overhead if it's left in? It's somewhat of a PITA to have to remember to alter my settings if I'm adjusting my data models. Thanks, Rob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Selecting MySQL engine (InnoDB/MyISAM) when creating models
There's a thread from June 28 '06 on this list about changing MySQL's storage engine from InnoDB to MyISAM for a particular table/model. Now, an InnoDB table respects foreign keys, and a MyISAM table ignores them. An "ALTER TABLE ... ENGINE = MyISAM" statement will fail if the table has any foreign keys defined. On the other hand, a "CREATE TABLE ... ENGINE = MyISAM" statement with foriegn key definitions works, silently ignoring the foreign keys. Subsequent "ALTER TABLE ... ADD CONSTRSAINT ... FOREIGN KEY..." are also silently ignored. So it seems here's a case where some extension to let the django app writer modify the "CREATE" sql would be very handy. I don't suppose anyone has a patch ready for it?http://code.djangoproject.com/ticket/ 347 implies such a thing would be frowned upon, but I'd rather have an unsupported patch then have to abandon "manage.py test" due to SQL errors... if not, I believe the shortest path would be a "pre_db_table" signal, which I should be able to whip up quickly. I suppose one could drop the foreign key constraints before altering the table, but it looks like they're named with some random characters in it. So one would have to look at the metadata, get the FK constraint name, and use that in generating the SQL: ugly, and more a job for Python, not the SQL that gets run by syncdb... What to do... (and I can't set the default storage type, since the app's deployed to a remote host, where we don't have access to the MySQL setup) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Selecting MySQL engine (InnoDB/MyISAM) when creating models
James Bennett wrote: > On 6/28/06, Geert Vanderkelen <[EMAIL PROTECTED]> wrote: >> I'm also not sure how you going to use the full text >> searching unless there is a patch now too.. > > For just querying against the DB, having fulltext indexes set up > should be sufficient; the DB's query optimizer will recognize that > there's an index for the table/column you're querying on and use that. > Not true for FULLTEXT indexes. These needs the usuage of special functions like: MATCH (col1) AGAINST (expr) In Django you need to set the field lookup type explained here: http://www.djangoproject.com/documentation/db_api/#field-lookups As far as I can see, only BOOLEAN MODE is supported, which will be used more frequently anyway. Cheers, Geert -- Geert Vanderkelen, Support Engineer, MySQL AB --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Selecting MySQL engine (InnoDB/MyISAM) when creating models
On 6/28/06, Geert Vanderkelen <[EMAIL PROTECTED]> wrote: > ALTER TABLE appname_modelname ENGINE=MyISAM; > > and you're done. That's something you'll have to do afterward doing a > 'syncdb' or sqlreset indeed. You can put that ALTER TABLE statement in the "sql" directory within your app, named in an appropriate way, and it'll get executed automatically for "syncdb" and "sqlreset", etc. See here: http://www.djangoproject.com/documentation/model_api/#providing-initial-sql-data Also, I've written this up as a FAQ -- thanks for asking the question. http://www.djangoproject.com/documentation/faq/#how-do-i-add-database-specific-options-to-my-create-table-statements-such-as-specifying-myisam-as-the-table-type Adrian -- Adrian Holovaty holovaty.com | djangoproject.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Selecting MySQL engine (InnoDB/MyISAM) when creating models
On 6/28/06, Geert Vanderkelen <[EMAIL PROTECTED]> wrote: > I'm also not sure how you going to use the full text > searching unless there is a patch now too.. For just querying against the DB, having fulltext indexes set up should be sufficient; the DB's query optimizer will recognize that there's an index for the table/column you're querying on and use that. -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Selecting MySQL engine (InnoDB/MyISAM) when creating models
On 6/28/06, Geert Vanderkelen <[EMAIL PROTECTED]> wrote: > Think you made a typo there or so.. > > MyISAM -> none transactional > InnoDB and NDBCluster (and BDB) -> transactional Yeah. Too much traveling, too much coding, too little sleep :( -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Selecting MySQL engine (InnoDB/MyISAM) when creating models
Hi Andrew, [EMAIL PROTECTED] wrote: > Hi, > > A total newbie question here, but is there a way to specify the engine > I would prefer when defining models for applications. Would really > prefer MyISAM, but MySQL keeps creating InnoDB when the tables are > automatically created. (Reason: MyISAM supports full-text searching > whereas InnoDB doesn't). I think this already came up somewhere in a bug report/feature request. > Please don't tell me I'll have to create tables manually to achieve > this! Unless I missed something, yup you have. But not really in the end. ALTER TABLE appname_modelname ENGINE=MyISAM; and you're done. That's something you'll have to do afterward doing a 'syncdb' or sqlreset indeed. InnoDB tables are needed to take advantage of transactions. With MyISAM you don't have that. I'm also not sure how you going to use the full text searching unless there is a patch now too.. Cheers, Geert -- Geert Vanderkelen, Support Engineer, MySQL AB --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Selecting MySQL engine (InnoDB/MyISAM) when creating models
Hi James, James Bennett wrote: > On 6/28/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> A total newbie question here, but is there a way to specify the engine >> I would prefer when defining models for applications. Would really >> prefer MyISAM, but MySQL keeps creating InnoDB when the tables are >> automatically created. (Reason: MyISAM supports full-text searching >> whereas InnoDB doesn't). > > You won't have to create tables manually, in one sense. However, > you'll end up doing a bit of indirection; Django will happily output > to a terminal the SQL it's going to execute to create the tables[1], > so you can use that, edit it to specify the table type you want, and > then source the file from inside MySQL. > > Also, keep in mind that not using MyISAM means losing transactions. Think you made a typo there or so.. MyISAM -> none transactional InnoDB and NDBCluster (and BDB) -> transactional Using InnoDB you can do transaction, using MyISAM not. Cheers, Geert -- Geert Vanderkelen, Support Engineer MySQL GmbH, Germany, www.mysql.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Selecting MySQL engine (InnoDB/MyISAM) when creating models
On 6/28/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > A total newbie question here, but is there a way to specify the engine > I would prefer when defining models for applications. Would really > prefer MyISAM, but MySQL keeps creating InnoDB when the tables are > automatically created. (Reason: MyISAM supports full-text searching > whereas InnoDB doesn't). You won't have to create tables manually, in one sense. However, you'll end up doing a bit of indirection; Django will happily output to a terminal the SQL it's going to execute to create the tables[1], so you can use that, edit it to specify the table type you want, and then source the file from inside MySQL. Also, keep in mind that not using MyISAM means losing transactions. [1] http://www.djangoproject.com/documentation/django_admin/#sql-appname-appname -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---