Re: [sqlalchemy] how to tell if a relationship was loaded or not ?

2014-06-12 Thread Ladislav Lenart
Hello. Out of curiosity. Do you want this during (unit) testing or in the application logic itself? Ladislav Lenart On 11.6.2014 20:17, Jonathan Vanasco wrote: I can't find this in the API or by using `inspect` on an object. I'm trying to find out how to tell if a particular relationship

Re: [sqlalchemy] how to tell if a relationship was loaded or not ?

2014-06-12 Thread Jonathan Vanasco
On Wednesday, June 11, 2014 7:11:35 PM UTC-4, Michael Bayer wrote: usually we do key in obj.__dict__ or key in inspect(obj).dict. wow. i was really over-thinking this! @Ladislav this is for the application logic itself. trying to optimize db access. -- You received this message

[sqlalchemy] relationship issues

2014-06-12 Thread tyler
I can't seem to construct a relationship against this ServiceInstance class without having the Endpoint class inherit from a new declarative_base(). I've tried several different methods of calling relationship() and the error messages are fairly similar. Below I've shown the two classes as

Re: [sqlalchemy] relationship issues

2014-06-12 Thread Simon King
On Thu, Jun 12, 2014 at 4:39 PM, ty...@beanfield.com wrote: I can't seem to construct a relationship against this ServiceInstance class without having the Endpoint class inherit from a new declarative_base(). I've tried several different methods of calling relationship() and the error

Re: [sqlalchemy] relationship issues

2014-06-12 Thread tyler
I have tried calling relationship without foreign_keys or primaryjoin, in which case I get an error message suggesting I specify foreign_keys. Base is the same class for both model classes in the case where this does not work. When each model class has a different Base class things work fine.

Re: [sqlalchemy] relationship issues

2014-06-12 Thread tyler
Also, thanks for the quick reply. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to

Re: [sqlalchemy] relationship issues

2014-06-12 Thread Simon King
In that case, could you send a stripped-down single-file test case with just those 2 classes that shows the problem? Thanks, Simon On Thu, Jun 12, 2014 at 5:13 PM, ty...@beanfield.com wrote: I have tried calling relationship without foreign_keys or primaryjoin, in which case I get an error

Re: [sqlalchemy] relationship issues

2014-06-12 Thread Simon King
For what it's worth, the following script works for me, but I only have access to sqlite at the moment, which doesn't support multiple schemas, so I had to comment those bits out. If you uncomment those and run it against your database, does it fail? If so, the problem would seem to be something

Re: [sqlalchemy] relationship issues

2014-06-12 Thread tyler
Thanks, I ran a similar script without any problems. It seems there's a modification somewhere to the Base we are using that causes the conflict. On Thursday, June 12, 2014 12:26:45 PM UTC-4, Simon King wrote: For what it's worth, the following script works for me, but I only have access to