[sqlalchemy] Re: Attribute expiration

2009-03-30 Thread Christiaan Putter
Thanks for the the advice Domen, that seems to clear up many of my problems :-) So right now I'm able to create a session, pull a few thousand records and then close that session. Then those instances get displayed in the gui and might get changed by some other threads, which will commit them

[sqlalchemy] Re: Getting FlushError trying to merge related objects

2009-03-30 Thread Yassen Damyanov
Mike, thanks so much for responding. --- On Sat, 3/28/09, Michael Bayer mike...@zzzcomputing.com wrote: From: Michael Bayer mike...@zzzcomputing.com Subject: [sqlalchemy] Re: Getting FlushError trying to merge related objects To: sqlalchemy@googlegroups.com Date: Saturday, March 28,

[sqlalchemy] Re: Getting FlushError trying to merge related objects

2009-03-30 Thread Yassen Damyanov
--- On Mon, 3/30/09, Yassen Damyanov yassen_...@yahoo.com wrote: It has also two dirty CbPerson who's attributes correspond to those already stored in the database. (I don't see the CbRecord object amongst the dirty objects at that time.) I am sorry, forgot to mention that these two ARE

[sqlalchemy] Re: Seperate History Tables

2009-03-30 Thread Suha Onay
İnstalled nose and tested: no error It is OK now. To make it easy for the developers not to care about the history tables and versioning, is it possible not to define _history models manually and make history_meta to generate them automatically? Suha On Fri, Mar 27, 2009 at 20:09, Michael Bayer

[sqlalchemy] Re: Seperate History Tables

2009-03-30 Thread Suha Onay
The problem is i defined the history class with the following way (examining the test_versioning file): -- Base = declarative_base(metaclass=VersionedMeta) class User(Base): __tablename__ = 'users' id = sa.Column(sa.Integer, primary_key=True)

[sqlalchemy] Postgres backend doesn't add some objects

2009-03-30 Thread Marcin Krol
Hello everyone, I switched from sqlite to postgres and the problem is that many tables are not filled with data when my util adds them (while there was no such problem with sqlite): INFO:sqlalchemy.engine.base.Engine.0x...dbd4:INSERT INTO os_version (id, OS_version) VALUES (%(id) s,

[sqlalchemy] more than one link between 2 tables

2009-03-30 Thread Marcin Krol
Hello everyone, Anybody? I need to do smth like this in a mapper() call for table 'hosts': 'Earliest_reservation':relation(Reservation, order_by=Reservation.id, backref='hosts'), 'Reservations':relation(Reservation, secondary=reservation_hosts_assoc_table, backref='hosts') That is, I need to

[sqlalchemy] Re: more than one link between 2 tables

2009-03-30 Thread Michael Bayer
On Mar 30, 2009, at 4:14 AM, Marcin Krol wrote: Hello everyone, Anybody? I need to do smth like this in a mapper() call for table 'hosts': 'Earliest_reservation':relation(Reservation, order_by=Reservation.id, backref='hosts'), 'Reservations':relation(Reservation,

[sqlalchemy] Re: Seperate History Tables

2009-03-30 Thread Michael Bayer
On Mar 30, 2009, at 4:32 AM, Suha Onay wrote: İnstalled nose and tested: no error It is OK now. To make it easy for the developers not to care about the history tables and versioning, is it possible not to define _history models manually and make history_meta to generate them

[sqlalchemy] Re: Seperate History Tables

2009-03-30 Thread Michael Bayer
On Mar 30, 2009, at 5:10 AM, Suha Onay wrote: The problem is i defined the history class with the following way (examining the test_versioning file): -- Base = declarative_base(metaclass=VersionedMeta) class User(Base): __tablename__ =

[sqlalchemy] Re: Postgres backend doesn't add some objects

2009-03-30 Thread Michael Bayer
On Mar 30, 2009, at 6:20 AM, Marcin Krol wrote: Hello everyone, I switched from sqlite to postgres and the problem is that many tables are not filled with data when my util adds them (while there was no such problem with sqlite): INFO:sqlalchemy.engine.base.Engine.0x...dbd4:INSERT

[sqlalchemy] Re: Clearing out a scoped session

2009-03-30 Thread Michael Bayer
On Mar 29, 2009, at 11:00 PM, iain duncan wrote: Hi Mike, I tried out the merging, but am hitting the snag that objects referred to in relations are now going into the db twice. Ie class MySeedData(SeedData): van = Region(name=Vancouver) event_1 = Event(name=Event 1, region=van) is

[sqlalchemy] Re: Getting FlushError trying to merge related objects

2009-03-30 Thread Michael Bayer
On Mar 30, 2009, at 3:35 AM, Yassen Damyanov wrote: The strange thing is (I'm checking this in the debugger) -- the newRecord (which is CbRecord) looks perfect after creation -- all five persons are attached to it via the 'persons' collection; all 'parent' attributes are properly

[sqlalchemy] Re: Postgres backend doesn't add some objects

2009-03-30 Thread Marcin Krol
Michael Bayer wrote: INFO:sqlalchemy.engine.base.Engine.0x...dbd4:{'OS_version': u'RHEL 5 64 ZSERIES', 'id': 8L} INFO:sqlalchemy.engine.base.Engine.0x...dbd4:select nextval('os_version_id_seq') INFO:sqlalchemy.engine.base.Engine.0x...dbd4:None there seems to be rows inserted there.

[sqlalchemy] Re: more than one link between 2 tables

2009-03-30 Thread Marcin Krol
Michael Bayer wrote: I need to do smth like this in a mapper() call for table 'hosts': 'Earliest_reservation':relation(Reservation, order_by=Reservation.id, backref='hosts'), 'Reservations':relation(Reservation, secondary=reservation_hosts_assoc_table, backref='hosts') That is, I need to

[sqlalchemy] Re: Postgres backend doesn't add some objects

2009-03-30 Thread Michael Bayer
On Mar 30, 2009, at 9:51 AM, Marcin Krol wrote: Michael Bayer wrote: INFO:sqlalchemy.engine.base.Engine.0x...dbd4:{'OS_version': u'RHEL 5 64 ZSERIES', 'id': 8L} INFO:sqlalchemy.engine.base.Engine.0x...dbd4:select nextval('os_version_id_seq')

[sqlalchemy] Re: more than one link between 2 tables

2009-03-30 Thread Michael Bayer
On Mar 30, 2009, at 9:58 AM, Marcin Krol wrote: Michael Bayer wrote: I need to do smth like this in a mapper() call for table 'hosts': 'Earliest_reservation':relation(Reservation, order_by=Reservation.id, backref='hosts'), 'Reservations':relation(Reservation,

[sqlalchemy] Re: Postgres backend doesn't add some objects

2009-03-30 Thread Marcin Krol
Michael Bayer wrote: uh wait, how are you adding your objects to the Session ? are you calling commit()? I notice there's no commit in the logs which is likely the source of your issue. I do call commit, it just turns out I missed an exception in the log that took place before

[sqlalchemy] Re: Getting FlushError trying to merge related objects

2009-03-30 Thread Yassen Damyanov
On Mon, Mar 30, 2009 at 5:30 PM, Michael Bayer mike...@zzzcomputing.com wrote: can you produce a small test case illustrating this ? Sure, I'll do my best to produce one for you.  we have tests exercising merge() in conjunction with delete-orphan cascade but perhaps there is a bug here.