Re: [sqlalchemy] (OperationalError) no such column when child class uses different name for primary key in polymorphic relationship and a subselect issued

2015-11-23 Thread Martin Pengelly-Phillips
Thanks Michael. On Saturday, 21 November 2015 22:35:14 UTC, Michael Bayer wrote: > > > > On 11/20/2015 12:20 PM, Martin Pengelly-Phillips wrote: > > Hi there, > > > > Using SQLAlchemy 1.0.9 > > > > I am dealing with some legacy code and came a

[sqlalchemy] (OperationalError) no such column when child class uses different name for primary key in polymorphic relationship and a subselect issued

2015-11-20 Thread Martin Pengelly-Phillips
Hi there, Using SQLAlchemy 1.0.9 I am dealing with some legacy code and came across the following issue. It appears that in a polymorphic relationship SQLAlchemy is not able to correctly determine what to load for a relationship when using a subselect (due to limit on query) and child class

[sqlalchemy] Access foreign key value after collection modification before flush

2015-07-18 Thread Martin Pengelly-Phillips
Hello, I'm curious about the behaviour of foreign keys when modifying collections as I want to be able to get the value before flush for some business logic validation. The following is a cut down version of the association list example: import uuid from sqlalchemy import Column, ForeignKey,

[sqlalchemy] Custom Comparator with order_by

2008-06-06 Thread Martin Pengelly-Phillips
Hi there, Quick question - is it possible to get a custom comparator to work with order_by? At present my code based on SA/examples/vertical/dictlike- polymorphic.py raises a NotImplementedError when attempting to use the value in an order_by statement. ta, Martin --- q =

[sqlalchemy] Re: Merge fails with ComparableProperty

2008-06-03 Thread Martin Pengelly-Phillips
Thanks as always for the quick response and fix. As a slight aside; I am using a MapperExtension to create an attribute on an object. When the object is stored, reloaded and then merged back into a session this attribute is no longer available. Any thoughts on why this might be? ta Martin

[sqlalchemy] Merge fails with ComparableProperty

2008-06-03 Thread Martin Pengelly-Phillips
Hi there, In SA 0.4.6 I get the following failure when attempting to merge an object that contains a ComparableProperty: prop.merge(self, instance, merged, dont_load, _recursive) TypeError: merge() takes exactly 4 arguments (6 given) Is this something I am doing wrong or a bug? ta,

[sqlalchemy] Re: Merge fails with ComparableProperty

2008-06-03 Thread Martin Pengelly-Phillips
is reconsituted. On Jun 3, 2008, at 11:08 AM, Martin Pengelly-Phillips wrote: Thanks as always for the quick response and fix. As a slight aside; I am using a MapperExtension to create an attribute on an object. When the object is stored, reloaded and then merged back into a session

[sqlalchemy] Re: Merge fails with ComparableProperty

2008-06-03 Thread Martin Pengelly-Phillips
Hmmm...I read your last mail as populate_instance works better in 0.5, but looking again I see that wasn't what you meant. As it is I just left my code as is and after upgrading to 0.5 it just worked... On Jun 3, 7:51 pm, Michael Bayer [EMAIL PROTECTED] wrote: er, what's the reconsistute hook

[sqlalchemy] Re: Custom comparator with in_ (and subqueries)

2008-05-28 Thread Martin Pengelly-Phillips
if the first case should work. ta, Martin On May 27, 9:09 pm, Michael Bayer [EMAIL PROTECTED] wrote: On May 27, 2008, at 3:11 PM, Martin Pengelly-Phillips wrote: Hi Michael, Thank you for the quick response. I had thought about using a straightforward OR statement - are you

[sqlalchemy] Re: Custom comparator with in_ (and subqueries)

2008-05-28 Thread Martin Pengelly-Phillips
Ah, apologies Michael - I should have mentioned that I am using the svn 0.5 checkout. In 0.4 it does raise NotImplementedError. In 0.5 it causes a recursion error. I understand that the working copy will be more susceptible to bugs etc so please take this as a note rather than a major issue. In

[sqlalchemy] Re: Custom comparator with in_ (and subqueries)

2008-05-27 Thread Martin Pengelly-Phillips
(type1 IN (list of type 1s) OR type2 IN (list of type 2s) ). On May 27, 2008, at 2:25 PM, Martin Pengelly-Phillips wrote: Hi there, Just came back to some code after a bit of a break and can't seem to get my head around how to correctly use the in_ method with a custom comparator

[sqlalchemy] Re: Custom comparator with in_ (and subqueries)

2008-05-27 Thread Martin Pengelly-Phillips
That makes sense - thanks again. Martin On May 27, 9:09 pm, Michael Bayer [EMAIL PROTECTED] wrote: On May 27, 2008, at 3:11 PM, Martin Pengelly-Phillips wrote: Hi Michael, Thank you for the quick response. I had thought about using a straightforward OR statement - are you

[sqlalchemy] Re: Many to many self referential relationship.

2008-02-21 Thread Martin Pengelly-Phillips
Hi Michael, As expected the trunk works perfectly. I am also looking into the comparator example you pointed to as this looks like it will help with a couple of other implementation details as well. Thanks again, Martin On Feb 20, 10:25 pm, Martin Pengelly-Phillips [EMAIL PROTECTED] wrote

[sqlalchemy] Re: Many to many self referential relationship.

2008-02-20 Thread Martin Pengelly-Phillips
: On Feb 20, 2008, at 1:01 PM, Martin Pengelly-Phillips wrote: I have attempted to solve this by using the concept of 'forwardAssociations' with a backref of 'backwardAssociations' and then a custom property 'associations' that retrieves and sets the real attributes accordingly (let me know

[sqlalchemy] Re: Slow relation based assignment.

2007-12-10 Thread Martin Pengelly-Phillips
hey mike, Just to confirm - trunk fixes problem with deletion. Additionally, I have removed the lazy loading condition and it maintains the speed of the query. Thanks again to the team, Martin On Dec 7, 4:14 pm, Michael Bayer [EMAIL PROTECTED] wrote: hey martin - this bug is fixed in

[sqlalchemy] Re: Slow relation based assignment.

2007-12-07 Thread Martin Pengelly-Phillips
improving upon backrefs to not load unloaded collections in any case, this is ticket #871. On Dec 5, 12:07 pm, Martin Pengelly-Phillips [EMAIL PROTECTED] wrote: Hello again, I have recently noticed that a particular assignment seems to be taking a relatively long time. Not being

[sqlalchemy] Re: Slow relation based assignment.

2007-12-07 Thread Martin Pengelly-Phillips
hey Mike, Thanks for the update - I'll try it out tomorrow. Martin p.s. Have I mentioned you guys provide the best support I have encountered in a long time (including commercial products). On Dec 7, 4:14 pm, Michael Bayer [EMAIL PROTECTED] wrote: hey martin - this bug is fixed in trunk

[sqlalchemy] Re: Slow relation based assignment.

2007-12-05 Thread Martin Pengelly-Phillips
are discussed at:http://www.sqlalchemy.org/docs/04/mappers.html#advdatamapping_relatio... we do have a ticket in trac to try improving upon backrefs to not load unloaded collections in any case, this is ticket #871. On Dec 5, 12:07 pm, Martin Pengelly-Phillips [EMAIL PROTECTED] wrote

[sqlalchemy] Slow relation based assignment.

2007-12-05 Thread Martin Pengelly-Phillips
Hello again, I have recently noticed that a particular assignment seems to be taking a relatively long time. Not being a database expert I am confused as to whether the last assignment 'person.tags = tags' should be so slow when referencing existing tags that are used by other entities - it

[sqlalchemy] Inheritance and eager loading - is contains_eager the answer?

2007-11-29 Thread Martin Pengelly-Phillips
Hi there, I have been using sqlalchemy for the past month with great success. However, recently I came across an unexpected situation. Essentially the results I was retrieving from the database via an ORM query were not including all the related attributes despite indicating eager loading on

[sqlalchemy] Re: Inheritance and eager loading - is contains_eager the answer?

2007-11-29 Thread Martin Pengelly-Phillips
Ah, thanks for the quick response Mike - I'll keep an eye out for the fix. Martin On Nov 29, 3:05 pm, Michael Bayer [EMAIL PROTECTED] wrote: On Nov 29, 2007, at 7:54 AM, Martin Pengelly-Phillips wrote: Hi there, I have been using sqlalchemy for the past month with great success