[sqlalchemy] Overriding onupdate

2009-03-09 Thread Sam Magister
Hi, I have a column definition that looks like: Column('is_cached', Boolean, onupdate=False, default=False, nullable=False) The onupdate feature works as advertised. My issue is that I have a caching script that calls update() which sets is_cached=True: conn.execute(mytable.update().where(myta

[sqlalchemy] yield_per using unbound memory, v0.5.0

2009-02-18 Thread Sam Magister
Hi, I have a table with millions of rows that I want to iterate through without running out of memory, and without waiting a long time for all rows to be loaded. Looking in the documentation, it seems that .yield_per(count) does what I want (I've read the warnings, and I'm not doing anything wit

[sqlalchemy] Copying SQLA objects from one DB to another

2008-10-09 Thread Sam Magister
Hi, I was wondering if there is an easy way to copy SQLA objects from one DB to another. I've poked around and found this thread: http://groups.google.com/group/sqlalchemy/browse_thread/thread/c1bd8cfe862441d6 but my application is different so I thought I'd post. Basically, I have a database of

[sqlalchemy] Mirroring attributes via the mapper

2008-10-06 Thread Sam Magister
Hi, I'm using 0.5rc1. I have a Employee class which I map to an employee table. The primary key column is called 'employee_id' for some reasons having to do with joined table inheritance. Depending on the application, I want to be able to refer a .employee_id or .id attribute of the Employee cla

[sqlalchemy] Re: Multiple Inheritance

2008-09-05 Thread Sam Magister
On Sep 5, 2:27 pm, Michael Bayer <[EMAIL PROTECTED]> wrote: > this looks pretty impressive !  I was poking around today to see how   > hard it would be to make "inherits" a list.     It seems like some   > things would be straightforward, others not.   Its interesting and I'm   > still thinking ab

[sqlalchemy] Re: Multiple Inheritance

2008-09-05 Thread Sam Magister
On Sep 5, 2:14 pm, [EMAIL PROTECTED] wrote: > just a theoretical comment... so instead of relying on SA mapper logic > to automaticaly put the discriminator/s, u are doing it on a level > above, in a way - as SA does not know about the (multiple) > inheritance that those imply. can be useful as an

[sqlalchemy] Re: Multiple Inheritance

2008-09-05 Thread Sam Magister
I've come up with an implementation based on concrete table inheritance, without touching any SQLA internals like Michael suggested. I've also added a discriminator to both base classes, 'citizen_type' and 'employee_type'. The discriminator is set via the before_insert() method of a MapperExtensio

[sqlalchemy] Re: Multiple Inheritance

2008-09-04 Thread Sam Magister
On Sep 3, 8:25 pm, Michael Bayer <[EMAIL PROTECTED]> wrote: > You can certainly map to any of the hierarchies indicated in that   > article, but you wouldn't be able to take advantage of SQLA's   > "polymorphic" capabilities, which are designed to only handle single   > inheritance.   You'd reall

[sqlalchemy] Re: Multiple Inheritance

2008-09-04 Thread Sam Magister
Michael, Thanks for the thoughtful replies. I'm going to explore the options you raised here. I'll post back with any insights I come to. Best, Sam --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group

[sqlalchemy] Multiple Inheritance

2008-09-03 Thread Sam Magister
I was wondering if it is possible to set up joined table inheritance so that a subclass inherits from more than one base table. To extend the example given in the documentation, we would have a base class 'Employee' and a base class 'Citizen' such that an 'Engineer' would inherit from both Employe

[sqlalchemy] onupdate Column attribute with joined table inheritance question

2008-09-02 Thread Sam Magister
Hi, I'm using joined table inheritance much like the example given here: http://www.sqlalchemy.org/docs/05/mappers.html#advdatamapping_mapper_inheritance_joined Additionally, in the employees table, I would like an update_timestamp column of type DateTime: Column('update_timestamp', DateTime, o