[sqlalchemy] Polymorphic write - 'InstanceState' object has no attribute 'manager'

2010-05-07 Thread andrew cooke
Hi, This trace is from some code that is loading a lot of objects (and which usually does so with no problems). I don't have more details yet (it will be quite some work to find out exactly what data is causing the error), but it does use joined table inheritance. Does anyone have any idea

Re: [sqlalchemy] Polymorphic write - 'InstanceState' object has no attribute 'manager'

2010-05-07 Thread Michael Bayer
this looks like some kind of serialization issue. are you deserializing instances before mappers have been compiled ?if you upgrade to 0.6, this will raise an error immediately at the point at which it occurs. On May 7, 2010, at 9:49 AM, andrew cooke wrote: Hi, This trace is from

[sqlalchemy] Re: Polymorphic write - 'InstanceState' object has no attribute 'manager'

2010-05-07 Thread andrew cooke
As far as I know, I'm doing nothing that complex. I am creating a pile of mapped objects in Python and then dumping them to the database. The most likely cause is that a field is None, or of the incorrect type in some way, I would have guessed. Andrew On May 7, 9:56 am, Michael Bayer

Re: [sqlalchemy] Re: Polymorphic write - 'InstanceState' object has no attribute 'manager'

2010-05-07 Thread Michael Bayer
manager is an attribute on InstanceState that is set at construction time, and is never changed thereafter.Looking at your error more closely, its not that manager is None, its not even present. That can only happen if something del'ed the manager attribute, the InstanceState somehow went

[sqlalchemy] Problems with CachingQuery, query is performed but data is returned from cache

2010-05-07 Thread Ergo
Hello, I'm having a strange problem with CachingQuery. I have a model that looks like this: User(object): . @classmethod def by_id(cls, id, cache=FromCache(default, by_id), invalidate=False): q = meta.Session.query(User).filter(User.id == id) if cache: q

[sqlalchemy] Two subclasses (single table inheritance) both requiring the same columns

2010-05-07 Thread Oliver Beattie
Hi there, I have some (declarative, polymorphic) classes that use single-table inheritance. My configuration is similar to the below: class BasicObject(Base): col1 = Column(…) # discriminator, polymorphic setup etc class ObjectOne(BasicObject): col2 = Column(…) col3 = Column(…) class

Re: [sqlalchemy] Two subclasses (single table inheritance) both requiring the same columns

2010-05-07 Thread Conor
On 05/07/2010 09:59 AM, Oliver Beattie wrote: Hi there, I have some (declarative, polymorphic) classes that use single-table inheritance. My configuration is similar to the below: class BasicObject(Base): col1 = Column(…) # discriminator, polymorphic setup etc class

Re: [sqlalchemy] PostgreSQL hstore custom type?

2010-05-07 Thread David Gardner
Thank you, I haven't started using hstore in my production environment yet, but wanted to do some tests with it as a way for users to attach arbitrary key/value metadata to nodes. Are you currently using a Gin or Gist index on your hstore columns? Yes, actually I've got a pretty good start on

Re: [sqlalchemy] Problems with CachingQuery, query is performed but data is returned from cache

2010-05-07 Thread Michael Bayer
On May 7, 2010, at 10:44 AM, Ergo wrote: now unless i call User.by_id(id, invalidate=True), All my queries contain wrong cached data. even if i do directly in controller of my app something like: c.users = meta.Session.query(User).order_by(User.username).limit(30) the returned rows will

[sqlalchemy] Re: Problems with CachingQuery, query is performed but data is returned from cache

2010-05-07 Thread Ergo
Hi, I do something like this to invalidate: --code-- User.by_id(id, invalidate=True) --code-- and on next request c.user = User.by_id(id) and no - regular query DOES NOT return right contents for me. c.users = meta.Session.query(User).order_by(User.username).limit(30) - this will only return

Re: [sqlalchemy] Re: Problems with CachingQuery, query is performed but data is returned from cache

2010-05-07 Thread Michael Bayer
On May 7, 2010, at 12:41 PM, Ergo wrote: Hi, I do something like this to invalidate: --code-- User.by_id(id, invalidate=True) --code-- and on next request c.user = User.by_id(id) and no - regular query DOES NOT return right contents for me. c.users =

[sqlalchemy] Re: Problems with CachingQuery, query is performed but data is returned from cache

2010-05-07 Thread Ergo
On 7 Maj, 18:52, Michael Bayer mike...@zzzcomputing.com wrote: expire_all() your session.  that is why you are seeing your stale cache data with a query that does not specify cache. Was that added recently ? this happens on subsequent requests in pylons application that in the end calls

Re: [sqlalchemy] Re: Problems with CachingQuery, query is performed but data is returned from cache

2010-05-07 Thread Michael Bayer
On May 7, 2010, at 12:56 PM, Ergo wrote: On 7 Maj, 18:52, Michael Bayer mike...@zzzcomputing.com wrote: expire_all() your session. that is why you are seeing your stale cache data with a query that does not specify cache. Was that added recently ? this happens on subsequent requests in

[sqlalchemy] Re: Problems with CachingQuery, query is performed but data is returned from cache

2010-05-07 Thread Ergo
This is only happening when one uses QueryCache? Im completly lost now because back in 0.5.x i never saw a single problem of this kind. Every new request would use new correct data. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this

[sqlalchemy] Re: [Distutils] inability to pass setup.py command line arguments to dependency setups

2010-05-07 Thread Kent Bower
Just because there are configuration problems associated with adding a feature like the one I needed is absolutely no reason to abandon it when it can bring value to the tool if used correctly and in some circumstances. I considered some of those exact complications what if it was already

Re: [sqlalchemy] Re: Problems with CachingQuery, query is performed but data is returned from cache

2010-05-07 Thread Michael Bayer
the caching query example doesn't work with 0.5, so there's nothing to compare with 0.5. The workings of the identity map have not changed. On May 7, 2010, at 1:46 PM, Ergo wrote: This is only happening when one uses QueryCache? Im completly lost now because back in 0.5.x i never saw a

Re: [sqlalchemy] Re: [Distutils] inability to pass setup.py command line arguments to dependency setups

2010-05-07 Thread Michael Bayer
I'd only mention that Storm has a C extension/non C extension flag as well, and only offers one source distribution on Pypi. You have to modify a variable directly within setup.py. Our setup.py features the same capability (its just our C extension is off by default for 0.6 since it was

[sqlalchemy] Re: Problems with CachingQuery, query is performed but data is returned from cache

2010-05-07 Thread Ergo
Im lost and clueless maybe im completly dumb :( im trying really hard but i cant understand the problem. every request calls meta.Session.remove() at the end of request - i checked it does that. Now even when i do: meta.Session.query(User).order_by(User.username).limit(30) I see the query

Re: [sqlalchemy] Re: Problems with CachingQuery, query is performed but data is returned from cache

2010-05-07 Thread Michael Bayer
what happens when you rip out all cache code entirely ? you ceratainly need to shut all of that off unconditionally before attempting to understand your issue. On May 7, 2010, at 2:17 PM, Ergo wrote: Im lost and clueless maybe im completly dumb :( im trying really hard but i cant

[sqlalchemy] Re: Problems with CachingQuery, query is performed but data is returned from cache

2010-05-07 Thread Ergo
ok, i THINK i understand whats going on... i reproduced it and i think i understand whats going on since i was able to track the problem by restarting memcache and noticing that it gives me right values: its kinda deceiving at first, i do a request in application: lets assume we have a users

Re: [sqlalchemy] Re: Problems with CachingQuery, query is performed but data is returned from cache

2010-05-07 Thread Michael Bayer
it is 100% expected yes. its generally not a good idea to specify any caching for a particular entity type in a particular request where you expect to be getting fresh data from the DB for that entity type. On May 7, 2010, at 2:37 PM, Ergo wrote: ok, i THINK i understand whats going on... i

[sqlalchemy] Re: [Distutils] inability to pass setup.py command line arguments to dependency setups

2010-05-07 Thread Kent
Mike, Can I just take a second to thank you for your patience in running this forum? There are so many rude, arrogant software developers, and you seem to not be like them at all. Thanks. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to

Re: [sqlalchemy] Re: [Distutils] inability to pass setup.py command line arguments to dependency setups

2010-05-07 Thread Gaetan de Menten
FWIW, it is perfectly possible to package the thing separately as Glyph seem to suggest, even if the feature is enabled through an option. For example, Debian does it: http://packages.debian.org/experimental/python-sqlalchemy-ext On Fri, May 7, 2010 at 19:56, Kent Bower k...@retailarchitects.com

Re: [Distutils] [sqlalchemy] Re: inability to pass setup.py command line arguments to dependency setups

2010-05-07 Thread Michael Bayer
The build option for C extension or not is taken directly from the setup.py of Genshi, the template language, and as I said was also inspired by what Storm does in this regard. I think once we put the flag on by default there really won't be any controversy anymore - both of those packages

Re: [sqlalchemy] PostgreSQL hstore custom type?

2010-05-07 Thread Kyle Schaffrick
On Fri, 7 May 2010 09:01:05 -0700 David Gardner dgard...@creatureshop.com wrote: Thank you, I haven't started using hstore in my production environment yet, but wanted to do some tests with it as a way for users to attach arbitrary key/value metadata to nodes. Are you currently using a Gin or