[sqlalchemy] Re: Modification tracking

2013-08-23 Thread Jonathan Vanasco
I had to do this last week. I posted a recipe in this thread: https://groups.google.com/forum/#!topic/sqlalchemy/Xr1llnf5tzQ tracked objects inherit from RevisionObject, which adds 2 columns to the database: revision_id (INT) revision_history (HSTORE) it also adds 2 methods:

[sqlalchemy] testing for an association proxy (possible bug and patch included)

2013-08-23 Thread Jonathan Vanasco
I have this general structure: class Person: # orm relationships are preceded by (o)ne or (l)ist o_Person2Address_ActiveShipping = sa.orm.relationship( Person2Address, primaryjoin=and_( Person2Address.person_id==Person.id , Person2Address.role_id=='active-shipping' ),

Re: [sqlalchemy] Feedback appreciated

2013-08-23 Thread Konsta Vesterinen
On Friday, August 23, 2013 1:52:41 AM UTC+3, Michael Bayer wrote: wow that is quite a compliment, I of course have heard of Doctrine and met many PHP users who use it extensively. This is really amazing that you're A. using Python now B. using SQLAlchemy and C. writing full blown

[sqlalchemy] problems with temporary tables and commits

2013-08-23 Thread Tim Tisdall
I'll try to make this succinct... I'm creating a temporary table and then doing a query with it that takes a good length of time. I found that the source tables going into the temporary table were being locked after the temporary table was created even though they were no longer needed for

Re: [sqlalchemy] testing for an association proxy (possible bug and patch included)

2013-08-23 Thread Gombas, Gabor (IT)
On Fri, Aug 23, 2013 at 12:11:39PM -0700, Jonathan Vanasco wrote: i think a simple fix could be something like this ( line 240, sqlalchemy/ext/associationproxy.py ) if self.scalar: -if not getattr(obj, self.target_collection) -return

[sqlalchemy] OrderingList not updating position as expected

2013-08-23 Thread Kyle Marek-Spartz
Hello, I've ran into a potential issue with OrderingList. When we are creating a new child, we'd like to be able to simply specify child.parent (or child.parent_id), and have child.position be updated appropriately when committed. This saves querying for the parent object, and then appending

Re: [sqlalchemy] testing for an association proxy (possible bug and patch included)

2013-08-23 Thread jason kirtland
On Fri, Aug 23, 2013 at 2:31 PM, Gombas, Gabor (IT) gabor.gom...@morganstanley.com wrote: On Fri, Aug 23, 2013 at 12:11:39PM -0700, Jonathan Vanasco wrote: i think a simple fix could be something like this ( line 240, sqlalchemy/ext/associationproxy.py ) if self.scalar: -

Re: [sqlalchemy] problems with temporary tables and commits

2013-08-23 Thread Michael Bayer
well a CREATE TABLE will autocommit but only if it's on an Engine that's not already in a transactionand when you use a Session it sets up a transaction that stays open until you say commit(). I can see the problem here, one way around is to actually bind the Session to a connection like

Re: [sqlalchemy] OrderingList not updating position as expected

2013-08-23 Thread Michael Bayer
On Aug 23, 2013, at 6:07 PM, Kyle Marek-Spartz zeckal...@gmail.com wrote: Hello, I've ran into a potential issue with OrderingList. When we are creating a new child, we'd like to be able to simply specify child.parent (or child.parent_id), and have child.position be updated appropriately