Re: [sqlalchemy] Feature suggestion: fake ForeignKeyConstraints to simplify joins

2013-06-13 Thread Charlie Clark
Am 13.06.2013, 00:42 Uhr, schrieb Andy aml...@gmail.com: Ah, okay. I think I understand what I was missing initially. I've had another go at this and it seems to work as required, even on MySQL. Not sure how this all works with SQLAlchemy but I would expect it to be fine with it. insert into

Re: [sqlalchemy] Feature suggestion: fake ForeignKeyConstraints to simplify joins

2013-06-13 Thread Andy
On Thursday, June 13, 2013 1:59:16 AM UTC-7, Charlie Clark wrote: Am 13.06.2013, 00:42 Uhr, schrieb Andy aml...@gmail.com javascript:: Ah, okay. I think I understand what I was missing initially. I've had another go at this and it seems to work as required, even on MySQL. Not sure

Re: [sqlalchemy] Feature suggestion: fake ForeignKeyConstraints to simplify joins

2013-06-13 Thread Charlie Clark
Am 13.06.2013, 21:20 Uhr, schrieb Andy aml...@gmail.com: It's the original issue. The relation (that I want the ORM to see) isn't what's literally set in the schema by foreign keys, and the primaryjoin/foreign_keys ORM magic for this IMO sucks. Something like onetomany and manytoone in the

Re: [sqlalchemy] Feature suggestion: fake ForeignKeyConstraints to simplify joins

2013-06-12 Thread Charlie Clark
Am 11.06.2013, 23:47 Uhr, schrieb Andy aml...@gmail.com: I could do that, but I'd change the foreign key in favorites to point at group_things, since your favorite group must be a group that you're in. Then I'd drop the other foreign key constraint as unnecessary, since it's implied by the new

Re: [sqlalchemy] Feature suggestion: fake ForeignKeyConstraints to simplify joins

2013-06-12 Thread Andy
On Wednesday, June 12, 2013 7:52:27 AM UTC-7, Charlie Clark wrote: Am 11.06.2013, 23:47 Uhr, schrieb Andy aml...@gmail.com javascript:: I could do that, but I'd change the foreign key in favorites to point at group_things, since your favorite group must be a group that you're in. Then

Re: [sqlalchemy] Feature suggestion: fake ForeignKeyConstraints to simplify joins

2013-06-11 Thread Andy
On Friday, June 7, 2013 12:49:46 PM UTC-7, Charlie Clark wrote: Am 07.06.2013, 01:13 Uhr, schrieb Andy aml...@gmail.com javascript:: I may be misunderstanding the question, but the reason that having a favorite is optional is because I'm using mysql and mysql doesn't supported

Re: [sqlalchemy] Feature suggestion: fake ForeignKeyConstraints to simplify joins

2013-06-07 Thread Charlie Clark
Am 07.06.2013, 00:05 Uhr, schrieb Michael Bayer mike...@zzzcomputing.com: can you show me the alternate design you have in mind? I'm not sure what normalize to favorites with strict 1:1 looks like. this is all just my own curiosity. the issue at hand is something different. Well, I

Re: [sqlalchemy] Feature suggestion: fake ForeignKeyConstraints to simplify joins

2013-06-07 Thread Charlie Clark
Am 07.06.2013, 01:13 Uhr, schrieb Andy aml...@gmail.com: I may be misunderstanding the question, but the reason that having a favorite is optional is because I'm using mysql and mysql doesn't supported deferred constraints. Oh, I feel your pain! But you are using an engine that at leasts

[sqlalchemy] Feature suggestion: fake ForeignKeyConstraints to simplify joins

2013-06-06 Thread Andy
I've written a handful of primaryjoin and secondaryjoin attributes on Relationships. This mechanism is flexible, but it's error-prone, and I think that, at least for all the cases I've personally encountered, there could be a better way. As an example, I have: thing = Table('thing',

Re: [sqlalchemy] Feature suggestion: fake ForeignKeyConstraints to simplify joins

2013-06-06 Thread Michael Bayer
On Jun 6, 2013, at 2:21 PM, Andy aml...@gmail.com wrote: I've written a handful of primaryjoin and secondaryjoin attributes on Relationships. This mechanism is flexible, but it's error-prone, and I think that, at least for all the cases I've personally encountered, there could be a

Re: [sqlalchemy] Feature suggestion: fake ForeignKeyConstraints to simplify joins

2013-06-06 Thread Michael Bayer
On Jun 6, 2013, at 3:21 PM, Michael Bayer mike...@zzzcomputing.com wrote: Not only that, but we are now placing ORM-specific configuration into our Table metadata. What's wrong with doing it in relationship()?Clearly, the way primaryjoin works, in that it's an expression, is

Re: [sqlalchemy] Feature suggestion: fake ForeignKeyConstraints to simplify joins

2013-06-06 Thread Charlie Clark
Am 06.06.2013, 20:21 Uhr, schrieb Andy aml...@gmail.com: IOW I have things and groups. The rel table is a many-to-many relation between things and groups. A thing also may have a favorite group; if so, there has to be a rel between that thing and its favorite group. Are favourites

Re: [sqlalchemy] Feature suggestion: fake ForeignKeyConstraints to simplify joins

2013-06-06 Thread Michael Bayer
On Jun 6, 2013, at 5:18 PM, Charlie Clark charlie.cl...@clark-consulting.eu wrote: Am 06.06.2013, 20:21 Uhr, schrieb Andy aml...@gmail.com: IOW I have things and groups. The rel table is a many-to-many relation between things and groups. A thing also may have a favorite group; if so,

Re: [sqlalchemy] Feature suggestion: fake ForeignKeyConstraints to simplify joins

2013-06-06 Thread Charlie Clark
Am 06.06.2013, 23:36 Uhr, schrieb Michael Bayer mike...@zzzcomputing.com: On Jun 6, 2013, at 5:18 PM, Charlie Clark charlie.cl...@clark-consulting.eu wrote: Am 06.06.2013, 20:21 Uhr, schrieb Andy aml...@gmail.com: IOW I have things and groups. The rel table is a many-to-many relation

Re: [sqlalchemy] Feature suggestion: fake ForeignKeyConstraints to simplify joins

2013-06-06 Thread Michael Bayer
On Jun 6, 2013, at 5:40 PM, Charlie Clark charlie.cl...@clark-consulting.eu wrote: Am 06.06.2013, 23:36 Uhr, schrieb Michael Bayer mike...@zzzcomputing.com: On Jun 6, 2013, at 5:18 PM, Charlie Clark charlie.cl...@clark-consulting.eu wrote: Am 06.06.2013, 20:21 Uhr, schrieb Andy

Re: [sqlalchemy] Feature suggestion: fake ForeignKeyConstraints to simplify joins

2013-06-06 Thread Andy
On Thursday, June 6, 2013 2:40:57 PM UTC-7, Charlie Clark wrote: Am 06.06.2013, 23:36 Uhr, schrieb Michael Bayer mik...@zzzcomputing.comjavascript:: On Jun 6, 2013, at 5:18 PM, Charlie Clark charli...@clark-consulting.eu javascript: wrote: Am 06.06.2013, 20:21 Uhr, schrieb