Re: [sqlalchemy] dogpile with SA inheritance

2014-04-15 Thread Pavel Aborilov
There is a lot of them. But I think it have to be simple. Like a normal query. >From the docs I understand how to cache query with FromCache, how to cache relationship with RelationshipCache, but I don't find how to cache polymorphic relationships. On Tuesday, April 15, 2014 5:56:36 PM UTC+4, Gu

Re: [sqlalchemy] dogpile with SA inheritance

2014-04-15 Thread Justin H
I might be wrong, but maybe you could also use eval if you don't know which class at runtime. i.e. session.query(Person).with_polymorphic(eval(classString)) where classString is a string equal to the name of the class. On Tuesday, April 15, 2014 6:56:36 AM UTC-7, Gunnlaugur Briem wrote: > > O

Re: [sqlalchemy] defining a relationship with "IS NOT"

2014-04-15 Thread Jonathan Vanasco
i'll try this later. i ended up 'monkeypatching' all these relationships onto the classes at the end of my models.py file , using the non-string column syntax. would have preferred to keep the entire class definition, together.. but I documented everything. -- You received this message bec

Re: [sqlalchemy] celery and race conditions

2014-04-15 Thread Jonathan Vanasco
if i have any time after shipping , i'll probably build in transaction support for celery and pyramid. I keep away from tossing ORM objects around the system. GETS are pretty cheap. my task arguments are generally: int = primary key of ORM object dict = "instructions" payload of what

Re: [sqlalchemy] dogpile with SA inheritance

2014-04-15 Thread Gunnlaugur Thor Briem
On Tue, Apr 15, 2014 at 1:11 PM, Pavel Aborilov wrote: > but I dont know on the time of query what the type of object it will be. > Then you can use session.query(Person).with_polymorphic('*') to mean joining to the tables of all mapped subclasses. (Be aware that this can become problematic if t

Re: [sqlalchemy] dogpile with SA inheritance

2014-04-15 Thread Pavel Aborilov
but I dont know on the time of query what the type of object it will be. On Tuesday, April 15, 2014 5:06:48 PM UTC+4, Gunnlaugur Briem wrote: > > Hi Pavel, > > You want: s.query(Person).with_polymorphic(Man).get(51) > > Cheers, > > Gulli > > > On Tue, Apr 15, 2014 at 12:59 PM, Pavel Aborilov > >

Re: [sqlalchemy] dogpile with SA inheritance

2014-04-15 Thread Gunnlaugur Thor Briem
Hi Pavel, You want: s.query(Person).with_polymorphic(Man).get(51) Cheers, Gulli On Tue, Apr 15, 2014 at 12:59 PM, Pavel Aborilov wrote: > Hello! > How can I cache query like this: > session.query(Person).get(51) > > where 51 is id of Man > > I can't access attribute age of Man without SELECT

[sqlalchemy] dogpile with SA inheritance

2014-04-15 Thread Pavel Aborilov
Hello! How can I cache query like this: session.query(Person).get(51) where 51 is id of Man I can't access attribute age of Man without SELECT. Models: class Person(Base): __tablename__ = 'person' id = Column(Integer, primary_key=True) name = Column(String(100), nullable=False)

Re: [sqlalchemy] query returns sqlalchemy.util._collections.KeyedTuple. not a maped class instance

2014-04-15 Thread Wichert Akkerman
On 15 Apr 2014, at 13:06, robert wrote: > Hi there, > > I m using SQLAlchemy V. 8.6 together with geomalcheny 2.4a second I get a call > > > I have a a mapped class: > > # tblKey2goGdataLocation > # > # > class tblK

Re: [sqlalchemy] defining a relationship with "IS NOT"

2014-04-15 Thread Richard Gerd Kuesters
yeah, that's why I shared this :) good to know, i'll use that from now on ;) my best regards, richard. On 04/15/2014 09:32 AM, Wichert Akkerman wrote: On 15 Apr 2014, at 13:25, Richard Gerd Kuesters mailto:rich...@humantech.com.br>> wrote: interesting, i didn't knew that :D i was using s

Re: [sqlalchemy] defining a relationship with "IS NOT"

2014-04-15 Thread Wichert Akkerman
On 15 Apr 2014, at 13:25, Richard Gerd Kuesters wrote: > interesting, i didn't knew that :D > > i was using shomething like (for softwares such as st2, which has pep8 > checking): > > ## variables > > NULL = None # f**k pep-8 > TRUE = True # f**k pep-8 > FALSE = False # f**k pep-8 You c

Re: [sqlalchemy] defining a relationship with "IS NOT"

2014-04-15 Thread Richard Gerd Kuesters
interesting, i didn't knew that :D i was using shomething like (for softwares such as st2, which has pep8 checking): ## variables NULL = None # f**k pep-8 TRUE = True # f**k pep-8 FALSE = False # f**k pep-8 so, "somecol != NULL" is not acused as violating pep8, lol. well, just for fun :)

Re: [sqlalchemy] query returns sqlalchemy.util._collections.KeyedTuple. not a maped class instance

2014-04-15 Thread Simon King
On Tue, Apr 15, 2014 at 12:06 PM, robert wrote: > Hi there, > > I m using SQLAlchemy V. 8.6 together with geomalcheny 2.4a second I get a > call > > > I have a a mapped class: > > # tblKey2goGdataLocation > # > > # > clas

[sqlalchemy] query returns sqlalchemy.util._collections.KeyedTuple. not a maped class instance

2014-04-15 Thread robert
Hi there, I m using SQLAlchemy V. 8.6 together with geomalcheny 2.4a second I get a call I have a a mapped class: # tblKey2goGdataLocation # # class tblKey2goGdataLocation(Base): __tablename__ = "tblKey2goGdat

Re: [sqlalchemy] celery and race conditions

2014-04-15 Thread Wichert Akkerman
On 15 Apr 2014, at 01:12, Jonathan Vanasco wrote: > i've got that now as a stopgap; i was hoping someone has better ideas. i > don't like the idea of a post-commit hook, because i fear requesting the > celery task request will create an error. I really don't want to build > `transaction` su