[sqlalchemy] Re: Relationship between objects which inherit the same parent

2011-05-19 Thread roderick
Works great! Thanks for your help! -- 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 sqlalchemy+unsubscr...@googlegroups.com. For more

[sqlalchemy] Re: creating tables and mappers multiple times in the same python script

2011-05-19 Thread Faheem Mitha
Hi, I'm belatedly following up on this earlier thread from October 2010. I decided to go back to it and figure out what the problem was. So, I created a working minimal example. I posted on StackOverflow, but it doesn't seem to have attracted much interest, so I'm copying it here. The SO link is

[sqlalchemy] column_property or relationship

2011-05-19 Thread boothead
Hi, I have a declarative class that I'd like to be able to add an attribute to: (please ignore the eye burning capitals - it's an existing schema :-) ) class Schedule(Base): __tablename__ = SomeSchedule __table_args__ = ( dict(schema=Schedule, useexisting=True) ) def

Re: [sqlalchemy] Re: creating tables and mappers multiple times in the same python script

2011-05-19 Thread Michael Bayer
On May 19, 2011, at 5:04 AM, Faheem Mitha wrote: from sqlalchemy import * from sqlalchemy.orm import * def make_pheno_table(meta, schema, name='pheno'): pheno_table = Table( name, meta, Column('patientid', String(60), primary_key=True), schema=schema, )

[sqlalchemy] Reusing sqlalchemy models across several web apps

2011-05-19 Thread 371c
Hi all, Scenario: i have a couple of models that i'd like to reuse across 3 different web apps (w1, w2, w3). The idea is to: * create a separate project (eg. models_app) to be installed into the python env via python setup install - sort of like a shared library. * In w1, w2 and/or w3, import

Re: [sqlalchemy] column_property or relationship

2011-05-19 Thread Michael Bayer
this is a bug ticket http://www.sqlalchemy.org/trac/ticket/2169, ill have a fix committed in a few minutes. On May 19, 2011, at 5:20 AM, boothead wrote: Hi, I have a declarative class that I'd like to be able to add an attribute to: (please ignore the eye burning capitals - it's an

Re: [sqlalchemy] column_property or relationship

2011-05-19 Thread Michael Bayer
this issue is fixed, you can download the tip of 0.6 or 0.7 in the development versions section at: http://www.sqlalchemy.org/download.html On May 19, 2011, at 11:49 AM, Michael Bayer wrote: this is a bug ticket http://www.sqlalchemy.org/trac/ticket/2169, ill have a fix committed in a few

[sqlalchemy] Row level permissions

2011-05-19 Thread Matthias
Hello, I want to secure my entities on an object-by-object basis. I.e. something like row level permissions. So I found http://www.sqlalchemy.org/trac/wiki/UsageRecipes/PreFilteredQuery which seems to proof that something like this is possible with sqlalchemy. On the other hand it

[sqlalchemy] Re: creating tables and mappers multiple times in the same python script

2011-05-19 Thread Faheem Mitha
Hi Michael, Thanks for the reply. On Thu, 19 May 2011 10:59:18 -0400, Michael Bayer mike...@zzzcomputing.com wrote: I'm sure I mentioned earlier, one of the reasons you're finding this difficult is because of this type of pattern, where you're calling mapper() and Table at a different scope

Re: [sqlalchemy] Re: creating tables and mappers multiple times in the same python script

2011-05-19 Thread Michael Bayer
On May 19, 2011, at 4:02 PM, Faheem Mitha wrote: Hi Michael, Thanks for the reply. On Thu, 19 May 2011 10:59:18 -0400, Michael Bayer mike...@zzzcomputing.com wrote: I'm sure I mentioned earlier, one of the reasons you're finding this difficult is because of this type of pattern,

[sqlalchemy] Re: creating tables and mappers multiple times in the same python script

2011-05-19 Thread Faheem Mitha
Hi Michael, On Thu, 19 May 2011 16:13:49 -0400, Michael Bayer mike...@zzzcomputing.com wrote: Dont wipe anything clean - keep the state of each set of stuff separate. A global dictionary perhaps, with an record inside for each configuration. Could you elaborate on what you have in mind?

Re: [sqlalchemy] Re: creating tables and mappers multiple times in the same python script

2011-05-19 Thread Michael Bayer
On May 19, 2011, at 4:48 PM, Faheem Mitha wrote: Hi Michael, On Thu, 19 May 2011 16:13:49 -0400, Michael Bayer mike...@zzzcomputing.com wrote: Dont wipe anything clean - keep the state of each set of stuff separate. A global dictionary perhaps, with an record inside for each

[sqlalchemy] Re: creating tables and mappers multiple times in the same python script

2011-05-19 Thread Faheem Mitha
On Thu, 19 May 2011 16:57:14 -0400, Michael Bayer mike...@zzzcomputing.com wrote: On May 19, 2011, at 4:48 PM, Faheem Mitha wrote: Hi Michael, On Thu, 19 May 2011 16:13:49 -0400, Michael Bayer mike...@zzzcomputing.com wrote: Dont wipe anything clean - keep the state of each set of stuff

[sqlalchemy] commit after every insert

2011-05-19 Thread jeff
I have an app that does an update or insert (can't guarantee the entry exists to start with). I'm trying to increase efficiency and notice a commit after every insert or update. Is there a way to hold off on the commit until one final commit? Not using the ORM for this particular piece. create

Re: [sqlalchemy] commit after every insert

2011-05-19 Thread Michael Bayer
On May 19, 2011, at 6:10 PM, jeff wrote: I have an app that does an update or insert (can't guarantee the entry exists to start with). I'm trying to increase efficiency and notice a commit after every insert or update. Is there a way to hold off on the commit until one final commit? Not

Re: [sqlalchemy] Reusing sqlalchemy models across several web apps

2011-05-19 Thread Michael Bayer
On May 19, 2011, at 11:06 AM, 371c wrote: Hi all, Scenario: i have a couple of models that i'd like to reuse across 3 different web apps (w1, w2, w3). The idea is to: * create a separate project (eg. models_app) to be installed into the python env via python setup install - sort of

Re: [sqlalchemy] Row level permissions

2011-05-19 Thread Michael Bayer
On May 19, 2011, at 1:16 PM, Matthias wrote: Hello, I want to secure my entities on an object-by-object basis. I.e. something like row level permissions. So I found http://www.sqlalchemy.org/trac/wiki/UsageRecipes/PreFilteredQuery which seems to proof that something like this is

Re: [sqlalchemy] Re: creating tables and mappers multiple times in the same python script

2011-05-19 Thread Michael Bayer
On May 19, 2011, at 5:24 PM, Faheem Mitha wrote: Unfortunately, that is not true. (So I guess just leaving the structure alone and switching dbs will not work.) There are 4 possible different database layouts. Also, there can be multiple schemas in each database. So you have a model with