This problem involves Pylons as well, but I believe the problem
involves how I'm using SQLAlchemy and therfore I'm posting here first.
I have a peculiar situation where I am trying to dynamically flip back
and forth between data models and running into problems. I am using
PostgreSQL with multiple identically named tables in different schemas
with a single master table in the public schema with the tables linked
by a serial foreign key.
Here are the basics:

public.master_table.master_serial = producta.sub_table.master_serial
public.master_table.master_serial = productb.sub_table.master_serial

All tables are defined using the declarative model and use
__table_args__ = {'schema':'schema name'}. I have tried importing the
master_table into the __init__ functions of the separate product
models and leaving it static but just re-mapping the foreign key to
the product each time I switch products. Neither method works.
Inside of my processing code I call function set_product_model which
does a simple assignment operation:
model.master_table = producta.master_table
model.sub_table = producta.sub_table
Everything works beautifully until I try to go back and use a product
that has already been processed. So in a sequence of:
1) process producta file
2) process productb file
3) process productc file
4) process producta file
step 4 fails when I try to append the sub_table object to the
master_table object with an AssertionError("Attribute sub_table on
class MasterTable doesn't handle objects of type class SubTable"

Thanks for the help!

-- 
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