On Jul 19, 2010, at 1:56 PM, Wade Leftwich wrote:

> I've been using Sqlalchemy to help migrate a bunch of websites into
> and out of Drupal. Since a Drupal 'node' can involve fields from 10 or
> 12 tables, the Declarative approach has been a real timesaver.
> 
> But now they're thrown me a serious curveball. It turns out that
> Drupal has a 'multisite' mode, where instead of one `node` table you
> have `site1_node`, `site2_node`, etc.
> 
> I'm not going to try to do a union of `site1_node` and `site2_node` or
> anything like that, but -- given that they have exactly the same
> structure, is there any way I can define a Node class and specify the
> __tablename__ during runtime?
> 
> Any advice appreciated; I'm prepared for the advice to be "Don't go
> there".

you'd probably want to use a variant of the entity name recipe, I've added a 
declarative example at the end:

http://www.sqlalchemy.org/trac/wiki/UsageRecipes/EntityName

when you create an instance of a class, you need to know what table you're 
going to want to be going to.  


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to