[sqlalchemy] Deleting an object with assignmapper fails
Hello, I'm using SQLAlchemy 0.3.4. I'm having the following problem when trying to delete an object: client = model.Client.get(1) client mp.models.clients.Client object at 0x1088210 client.delete() Traceback (most recent call last): File console, line 1, in ? File build/bdist.linux-x86_64/egg/sqlalchemy/ext/assignmapper.py, line 16, in do File build/bdist.linux-x86_64/egg/sqlalchemy/orm/session.py, line 323, in delete File build/bdist.linux-x86_64/egg/sqlalchemy/orm/mapper.py, line 1126, in cascade_iterator File build/bdist.linux-x86_64/egg/sqlalchemy/orm/properties.py, line 154, in cascade_iterator File build/bdist.linux-x86_64/egg/sqlalchemy/orm/attributes.py, line 686, in get_history File build/bdist.linux-x86_64/egg/sqlalchemy/orm/attributes.py, line 85, in get_history File build/bdist.linux-x86_64/egg/sqlalchemy/orm/attributes.py, line 190, in get File build/bdist.linux-x86_64/egg/sqlalchemy/orm/attributes.py, line 526, in commit_attribute File build/bdist.linux-x86_64/egg/sqlalchemy/orm/attributes.py, line 28, in lambda File build/bdist.linux-x86_64/egg/sqlalchemy/orm/attributes.py, line 383, in __iter__ TypeError: iteration over non-sequence Regards, -- Alexandre CONRAD --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: how to make a query for multilevel reference?
okay, how would u do something like (person.address1.country.name == 'France' or person.address2.country.name == 'Germany') note there are 2 different address1 and address2 fields of the person. and, how would this be like: (person.address1.country.name == 'France' or person.company.name == 'Acme') --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: is pool supposed to be able to handle its target db restarting?
On Jan 26, 5:49 pm, Michael Bayer [EMAIL PROTECTED] wrote: doing away with the __del__() thing ? what would we gain by removing the __del__() call ?one thing I should do is insure ORM etc. do not rely upon __del__() (which they shouldnt, although I just tested with the AssertionPool and...surprise) actually scratch that, the unit tests themselves call a bunch of insert() and delete() executes for which they dont close the result set (and therefore __del__ is what returns the connection in those cases). If i remove the __del__ from pool.py, change line 69 of test/orm/polymorph.py to close() the result of the table delete, and then run the test with --mockpool (asserts only one connection used throughout the app), all tests pass, which is a few dozen full blown round trips through the mapper/session. so the ORM is closing everything it opens. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: Tagging example
Damjan schrieb: Now, creating pages and then adding tags to them like so: p1.tags.append(Tag('test')) p2.tags.append(Tag('test')) will actually create two 'test' tags in the database... Have a look at my tagging tutorial at http://paddyland.serveblog.net/article/16#updating-tags Although it uses SQLObject, the pattern used in the 'update_tags' method (http://paddyland.serveblog.net/article/16#updating-tags) can be applied to SQLAlchemy as well. also does p1.tags be a list of Tag instances? Can it be a list of normal strings? taglist = [str(tag.name) for tag in p1.tags] HTH, Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: some failures on polymorphic-mapper with non-lazy relations
Employee points to Dept and Dept points to Director; Director inherits Employee. no other references. thats not the test case im talking about, you gave me just A and B with B point to A (which is A pointing to A). that right, i found another case giving the same error, and thought it is somewhat linked. just look at the queries these things generate, expecting eager in all cases from those relations is starting to push the envelope a bit further than I can handle myself (as well as what a DB can usually handle). is there any link between a relation being post_update and being lazy? no. that's all okay, i don't expect anything. i just want the thing to run. and i don't realy care about the lazy/eagerness that much. Can we invent some practical rule about what cannot (or should not) be lazy? a) self-reference and inheritance between pointing and pointed, in any direction b) anything else ?? i see rev.2257 Otherwise, it is a trial-and-error: - make some relation eager - try querying all classes around - make another relation eager ... until one hits some error - or succeeds --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: Persistence Layer best practices with SQLAlchemy
Mike, On a side note, do u have any ideas about supporting stored procedures in some way? Be it just knowing about them and maybe calling them, or on the other end, generating them? IMO they are _some_ way to hide some of those session.queries... Although i'm just extrapolating my own vision of what sql-server is. Last week i saw a huge application wholly working on an SQl-server, sending dialog-templates and what not to the thin-gui-only-client; _all_ written in stored procs. And i immediately ran away from it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: some failures on polymorphic-mapper with non-lazy relations
Can we invent some practical rule about what cannot (or should not) be lazy? sorry, what cannot (or should not) be _eager_ a) self-reference and inheritance between pointing and pointed, in any direction b) anything else ?? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---