Re: [sqlalchemy] SQLite: OperationalError when decoding 0x92 in TEXT column

2014-02-09 Thread Erich Blume
Thanks for the help on this, everyone! I found two ways to deal with this and figured I should share in case it comes up in the future. The first approach, the one I went with (because in my case, fidelity was not as important) was to alter the 'text_factory' the sqlite3 uses. One trick here was

Re: [sqlalchemy] SQLite: OperationalError when decoding 0x92 in TEXT column

2014-02-09 Thread Michael Bayer
On Feb 9, 2014, at 5:34 AM, Erich Blume blume.er...@gmail.com wrote: Then, you have to tell SQLAlchemy to convert these strings to unicode. I did not persue this approach far enough to find the right set of arguments but I imagine this would be very simple - set 'force_unicode' to True, I

[sqlalchemy] Many to many association record orphaned when deleting parent of parent of relation

2014-02-09 Thread Jay Pipes
Hi all, I have some models with the following relationship: An Organization can have many Groups A Group belongs to one Organization A User can belong to many Groups A Group can have many Users I use a mapping model called UserGroupMembership that stores the user_id, group_id relation of the

[sqlalchemy] Re: Many to many association record orphaned when deleting parent of parent of relation

2014-02-09 Thread Jay Pipes
Also note that I have tried this variation of code as well, using secondary=MAPPING_TABLE, with the same result: http://paste.openstack.org/show/63752/ -jay On Sunday, February 9, 2014 10:45:55 PM UTC-5, Jay Pipes wrote: Hi all, I have some models with the following relationship: An

Re: [sqlalchemy] Many to many association record orphaned when deleting parent of parent of relation

2014-02-09 Thread Michael Bayer
the problem is this: org = Organization(name='my org') sess.add(org) group = Group(name='my group') group.organization_id = org.id sess.add(group) when you assign group.organization_id = org.id, org has not been flushed yet so org.id is None. The org is then never

[sqlalchemy] What is the point to re-define each and every column in __init__ in a class?

2014-02-09 Thread Bao Niu
I'm new to sqlalchemy. I tried to search this question but didn't come up with accurate search terms. So I come here for some help from real people instead of search engine. For the following code: class Places(Base): __tablename__ = 'moz_places' id = Column(Integer,

Re: [sqlalchemy] What is the point to re-define each and every column in __init__ in a class?

2014-02-09 Thread Aseem Mohanty
As far as I understand it, its just a helper to initialize a new object. Some things to keep in mind: - You don't /have/ to provide all parameters, if some of your columns have default values you can only provide the required set of arguments - You don't /have/ to do that but then when you want