Re: [sqlalchemy] Pickle/beaker error with InstrumentedList

2011-12-30 Thread Arturo Sevilla
On Tuesday, December 27, 2011 7:22:03 AM UTC-8, Michael Bayer wrote: On Dec 27, 2011, at 4:54 AM, Arturo Sevilla wrote: Thanks for the code, your example runs without a problem. I've managed to locate the error. In reality it doesn't have to do with InstrumentedList. The problem

Re: [sqlalchemy] Pickle/beaker error with InstrumentedList

2011-12-30 Thread Arturo Sevilla
Ah, OK so what's happening is that _sa_instance_state hasn't yet been assigned to the User object during the unpickle process, then your __eq__() is trying to get at self.id which triggers the attribute system and requires a fully composed User object. Here you'd need to either have a

Re: [sqlalchemy] Pickle/beaker error with InstrumentedList

2011-12-30 Thread Arturo Sevilla
Nope, the problem persists, but not with the unpickle process but after it with composite attributes. For example, I have the first_name attribute on User, but also contact which is a MutableComposite. If I do the following (after the unpickle process): assert user.first_name = 'name' I don't

Re: [sqlalchemy] Pickle/beaker error with InstrumentedList

2011-12-30 Thread Arturo Sevilla
On Friday, December 30, 2011 8:26:45 PM UTC-8, Michael Bayer wrote: On Dec 30, 2011, at 7:46 PM, Arturo Sevilla wrote: Nope, the problem persists, but not with the unpickle process but after it with composite attributes. For example, I have the first_name attribute on User, but also

Re: [sqlalchemy] Pickle/beaker error with InstrumentedList

2011-12-27 Thread Arturo Sevilla
Thanks for the code, your example runs without a problem. I've managed to locate the error. In reality it doesn't have to do with InstrumentedList. The problem occurs when beaker pickle.load()s from its cache file (a pickled object in a file). I get the following exception (which makes beaker

[sqlalchemy] Pickle/beaker error with InstrumentedList

2011-12-24 Thread Arturo Sevilla
I have an error that occurs after an upgrade to 0.7.4 (from 0.6.8). I use classical mapping but I'm having the following exception when I add it to a session and save() it: TypeError: can't pickle function objects If I directly do pickle.dumps(obj) I get the following exception:

[sqlalchemy] Two bugs or different behaviors between 0.6 and 0.7

2011-08-07 Thread Arturo Sevilla
Hi, I think I have detected two bugs for PostgreSQL databases. I don't think is a different behavior between 0.6 and 0.7 as there is no problem with sqlite. In the following code I have a very simple model, which contains a helper pre-process list class, which just transforms strings into the

Re: [sqlalchemy] Does orm.synonym's comparator_factory work?

2011-08-06 Thread Arturo Sevilla
As a follow up to this thread, I've seen in the code in version 0.7.2 that comparator_factory is no longer working for CompositeProperty. Is this a bug? Reference: http://www.sqlalchemy.org/trac/browser/lib/sqlalchemy/orm/descriptor_props.py#L75 You can see that in the constructor there is no

Re: [sqlalchemy] Does orm.synonym's comparator_factory work?

2011-08-06 Thread Arturo Sevilla
I will see if later today I can provide some tests, or by tomorrow. I think the basic rationale is that a composite property should behave like a regular mapped property, and those have a comparator_factory, although I know this is probable a lame argument. -- You received this message

[sqlalchemy] Does orm.synonym's comparator_factory work?

2011-07-06 Thread Arturo Sevilla
Hi, I have a mapping between a table row and a python field, for which I have a synonym. I've read the documentation and it says: Each of column_property(), composite(), relationship(), and comparable_property() accept an argument called comparator_factory. For which I assume that synonym()

[sqlalchemy] MutableComposite has no attribute 'coerce'

2011-07-01 Thread Arturo Sevilla
Hi, I've been trying on the new futures of composite classes of SQLAlchemy 0.7, and I don't have any problems with the read-only default mapping. However, just when I inherit from MutableComposite I start to get an AttributeError exception when I set the value to None (AttributeError: type

Re: [sqlalchemy] MutableComposite has no attribute 'coerce'

2011-07-01 Thread Arturo Sevilla
Hi thanks, for answering. Yes I'm aware that setting it to a non-ContactInformation object will set off the coerce. However, if you put None to it also sets off the error, something which does not happen when you just have a non-mutable composite property. Should this be correct behavior?

Re: [sqlalchemy] MutableComposite has no attribute 'coerce'

2011-07-01 Thread Arturo Sevilla
Do you mean in 0.7.1 or in the snapshot you put here? -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To view this discussion on the web visit https://groups.google.com/d/msg/sqlalchemy/-/cT683Za9q90J. To post to this group, send email to

Re: [sqlalchemy] MutableComposite has no attribute 'coerce'

2011-07-01 Thread Arturo Sevilla
Great! It worked, I was going to suggest to impolemente coerce() in MutableComposite, but that's just what the snapshot has :) Do you know in which minor version should I expect to see this patch? Because while I can test it and make it work for my machine it would be better to have the

Re: [sqlalchemy] MutableComposite has no attribute 'coerce'

2011-07-01 Thread Arturo Sevilla
Nevermind I just realized that it says 0.7.2 in the CHANGE file. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To view this discussion on the web visit https://groups.google.com/d/msg/sqlalchemy/-/ri_r-8ywDlkJ. To post to this group, send email

Re: [sqlalchemy] MutableComposite has no attribute 'coerce'

2011-07-01 Thread Arturo Sevilla
My only doubt now is whether you can query over the fields of the composite attribute. In the documentation an example is made of a query with a comparison of the whole data structure: session.query(Vertex).filter(Vertex.start == Point(3, 4)) But it also says: As of SQLAlchemy 0.7, composites

[sqlalchemy] Re: Relationship (Foreign key) inside composite column

2011-01-12 Thread Arturo Sevilla
On Jan 10, 12:44 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Jan 10, 2011, at 2:21 PM, Arturo Sevilla wrote: Hello, Thanks again for the quick reply! I tried to isolate all the mapper columns to try to make it less confusing, now I know that was not a good idea

[sqlalchemy] Relationship (Foreign key) inside composite column

2011-01-10 Thread Arturo Sevilla
Hello, I'm trying to do the following: 'home': orm.composite( Address, user.c.HomeAddress_Street, # The following column is a UUID but is a foreign key to a mapped # table in SQLAlchemy, ideally would be to say relationship(City)

[sqlalchemy] Re: Relationship (Foreign key) inside composite column

2011-01-10 Thread Arturo Sevilla
, Arturo Sevilla wrote: Hello, I'm trying to do the following:       'home': orm.composite(            Address,            user.c.HomeAddress_Street,            # The following column is a UUID but is a foreign key to a mapped            # table in SQLAlchemy, ideally would be to say

[sqlalchemy] Problem dealing with dropping tables while having objects in session

2011-01-09 Thread Arturo Sevilla
Hello, I've been trying to do unit testing with SQLAlchemy and PostgreSQL. In my model/tables I have two entities state and country, state has a foreign key relating to country (no problems there). In my setUp() method I call create_all() for my metadata while in tearDown() I call drop_all().

[sqlalchemy] Re: Problem dealing with dropping tables while having objects in session

2011-01-09 Thread Arturo Sevilla
of the tearDown(). http://www.sqlalchemy.org/docs/orm/session.html#closing On Jan 9, 2011, at 6:24 AM, Arturo Sevilla wrote: Hello, I've been trying to do unit testing with SQLAlchemy and PostgreSQL. In my model/tables I have two entities state and country, state has a foreign