Re: Thoughts on solution to forward references in MySQL (#3615)

2011-07-06 Thread Carl Meyer
Hi Russell and Jim, On 07/06/2011 05:34 PM, Russell Keith-Magee wrote: > On Thu, Jul 7, 2011 at 5:05 AM, Jim D. wrote: >> * There's a DB feature can_defer_constraint_checks . I couldn't find much >> by way of documentation or or usage of this feature. But I was trying to

Re: Thoughts on solution to forward references in MySQL (#3615)

2011-07-06 Thread Andy Dustman
If you aren't using InnoDB, then it probably doesn't matter if you turn foreign key checks on or off: it becomes a no-op. There are some other storage engines that support transactions, and some of them might "do the right thing" with respect to deferred foreign key checks, but I think it does no

Re: Thoughts on solution to forward references in MySQL (#3615)

2011-07-06 Thread Russell Keith-Magee
On Thu, Jul 7, 2011 at 5:05 AM, Jim D. wrote: > Are any core devs interested in taking a closer look at the current patch on > this ticket (https://code.djangoproject.com/ticket/3615)? It's been through > several rounds of revision after discussion here and on the ticket

Re: Thoughts on solution to forward references in MySQL (#3615)

2011-07-06 Thread Jim D.
Are any core devs interested in taking a closer look at the current patch on this ticket (https://code.djangoproject.com/ticket/3615)? It's been through several rounds of revision after discussion here and on the ticket comment thread. As of right now the patch should apply cleanly and pass

Re: Thoughts on solution to forward references in MySQL (#3615)

2011-06-28 Thread Marco Paolini
Karen Tracey ha scritto: On Tue, Jun 28, 2011 at 8:44 AM, Jim Dalton > wrote: I have not had time to try out the patch, but did look at it. Doesn't the base implementation of disable_foreign_key_checks need to return False

Re: Thoughts on solution to forward references in MySQL (#3615)

2011-06-28 Thread akaariai
On Jun 28, 12:24 am, "Jim D." wrote: > I spent some time last week and over the weekend nailing down a > solution forhttps://code.djangoproject.com/ticket/3615. This is the > ticket about allowing forward references when loading data on the > MySQL InnoDB backend. My patch

Re: Thoughts on solution to forward references in MySQL (#3615)

2011-06-28 Thread Andy Dustman
On Mon, Jun 27, 2011 at 6:08 PM, Jacob Kaplan-Moss wrote: > On Mon, Jun 27, 2011 at 4:24 PM, Jim D. wrote: >> I spent some time last week and over the weekend nailing down a >> solution for https://code.djangoproject.com/ticket/3615 . This is the >>

Re: Thoughts on solution to forward references in MySQL (#3615)

2011-06-28 Thread Karen Tracey
On Tue, Jun 28, 2011 at 9:38 AM, Jim Dalton wrote: > "In fact, even functions without a return statement do return a value, > albeit a rather boring one. This value is called None (it’s a built-in > name). Writing the value None is normally suppressed by the interpreter if

Re: Thoughts on solution to forward references in MySQL (#3615)

2011-06-28 Thread Cal Leeming [Simplicity Media Ltd]
Ah, that makes perfect sense now. It's the same principle when doing a .sql import, you disable foreign_key_checks, import, then enable. Thanks for explaining this! Cal On Tue, Jun 28, 2011 at 2:41 PM, Jim Dalton wrote: > On Jun 28, 2011, at 6:29 AM, Cal Leeming

Re: Thoughts on solution to forward references in MySQL (#3615)

2011-06-28 Thread Jim Dalton
On Jun 28, 2011, at 6:29 AM, Cal Leeming [Simplicity Media Ltd] wrote: > Sorry for the noobish question but, could someone explain the definition of > "forward references"?? Is this a MySQL or a django term?? Google wasn't very > forthcoming :X Jacob actually requested that I add a note in the

Re: Thoughts on solution to forward references in MySQL (#3615)

2011-06-28 Thread Jim Dalton
On Jun 28, 2011, at 6:25 AM, Karen Tracey wrote: > It actually doesn't *need* to return False; pass is the same as not returning > anything or returning None. The boolean check just treats it the same way as > False. "Should it?" is another question. On the one hand it's a bit more > clear,

Re: Thoughts on solution to forward references in MySQL (#3615)

2011-06-28 Thread Cal Leeming [Simplicity Media Ltd]
Sorry for the noobish question but, could someone explain the definition of "forward references"?? Is this a MySQL or a django term?? Google wasn't very forthcoming :X Thanks Cal On Mon, Jun 27, 2011 at 10:24 PM, Jim D. wrote: > Hi all, > > I spent some time last week

Re: Thoughts on solution to forward references in MySQL (#3615)

2011-06-28 Thread Karen Tracey
On Tue, Jun 28, 2011 at 8:44 AM, Jim Dalton wrote: > > I have not had time to try out the patch, but did look at it. Doesn't the > base implementation of disable_foreign_key_checks need to return False > instead of just passing? The return value is used in loaddata

Re: Thoughts on solution to forward references in MySQL (#3615)

2011-06-28 Thread Jim Dalton
On Jun 28, 2011, at 5:27 AM, Karen Tracey wrote: > Also, though I don't have MySQL 4 handy to test on, I'd be astonished if > there were any issue there compared to MySQL 5. The set foreign_key_check > command is certainly supported in MySLQ 4 and the select being issued to do > the check is

Re: Thoughts on solution to forward references in MySQL (#3615)

2011-06-28 Thread Karen Tracey
On Mon, Jun 27, 2011 at 11:26 PM, Jim D. wrote: > My thinking at this point would be the performance is "good enough" for the > scope of the current ticket, and that if better performance were required or > desired, that could be facilitated under a separate ticket,

Re: Thoughts on solution to forward references in MySQL (#3615)

2011-06-27 Thread Jim D.
On Monday, June 27, 2011 7:04:09 PM UTC-7, Jim D. wrote: So that caveat aside, I will try later to find a large data set I can run > the query on to get an idea of what kind of performance hit the check > entails. If anyone else has a large data set with two related tables, you > can try it

Re: Thoughts on solution to forward references in MySQL (#3615)

2011-06-27 Thread Jim Dalton
On Jun 27, 2011, at 5:44 PM, Michael Blume wrote: > I see a variable saved_objects being written, but I don't see it being > accessed -- is this to ease future features, or am I missing a code path? Thanks good catch. This was a remnant from an earlier iteration of this patch, in which I tried

Re: Thoughts on solution to forward references in MySQL (#3615)

2011-06-27 Thread Michael Blume
Couple questions: I see a variable saved_objects being written, but I don't see it being accessed -- is this to ease future features, or am I missing a code path? If I'm reading correctly, check_for_invalid_foreign_keys extends over all the rows in a table. loaddata is called by syncdb and

Re: Thoughts on solution to forward references in MySQL (#3615)

2011-06-27 Thread Jim Dalton
On Jun 27, 2011, at 4:52 PM, Russell Keith-Magee wrote: > Unfortunately, not much. Your test has validated that the extra code > doesn't break anything under MyISAM, and this is certainly useful. > However, the root problem only exists with InnoDB because of its... > eclectic... implementation of

Re: Thoughts on solution to forward references in MySQL (#3615)

2011-06-27 Thread Russell Keith-Magee
On Tue, Jun 28, 2011 at 7:32 AM, Michael Blume wrote: > Just reloaded all our fixtures, and this seems to create no regressions with > MySQL Server version: 5.0.51a-3ubuntu5.5 (Ubuntu) > Most of our tables are backed by MyISAM, though, so I'm not sure how much > this helps.

Re: Thoughts on solution to forward references in MySQL (#3615)

2011-06-27 Thread Michael Blume
Just reloaded all our fixtures, and this seems to create no regressions with MySQL Server version: 5.0.51a-3ubuntu5.5 (Ubuntu) Most of our tables are backed by MyISAM, though, so I'm not sure how much this helps. On Mon, Jun 27, 2011 at 4:09 PM, Michael Blume wrote: >

Re: Thoughts on solution to forward references in MySQL (#3615)

2011-06-27 Thread Michael Blume
nitpick: I got a few complaints about trailing whitespace when I applied: /home/mike/sqlpatch.diff:36: trailing whitespace. /home/mike/sqlpatch.diff:42: trailing whitespace. /home/mike/sqlpatch.diff:126: trailing whitespace. /home/mike/sqlpatch.diff:148: trailing whitespace.

Re: Thoughts on solution to forward references in MySQL (#3615)

2011-06-27 Thread Jacob Kaplan-Moss
On Mon, Jun 27, 2011 at 5:27 PM, Jim D. wrote: > Does it work in production is a hard question for me to answer, if I > understood your question properly. In my projects, I really only touch the > loaddata command when I'm running tests (I guess loading data via >

Re: Thoughts on solution to forward references in MySQL (#3615)

2011-06-27 Thread Jim D.
On Monday, June 27, 2011 3:08:03 PM UTC-7, Jacob Kaplan-Moss wrote: > > I left some comments on the patch on the ticket. > Excellent just saw those. I'll take a look. > > I'm using django-threadedcomments on a project, which has forward > > references in one of its test fixtures, so I'm

Re: Thoughts on solution to forward references in MySQL (#3615)

2011-06-27 Thread Jacob Kaplan-Moss
On Mon, Jun 27, 2011 at 4:24 PM, Jim D. wrote: > I spent some time last week and over the weekend nailing down a > solution for https://code.djangoproject.com/ticket/3615 . This is the > ticket about allowing forward references when loading data on the > MySQL InnoDB

Thoughts on solution to forward references in MySQL (#3615)

2011-06-27 Thread Jim D.
Hi all, I spent some time last week and over the weekend nailing down a solution for https://code.djangoproject.com/ticket/3615 . This is the ticket about allowing forward references when loading data on the MySQL InnoDB backend. My patch implements the proposed change (disabling foreign key