Hi
I'm having trouble with define mapper for class which will include
data from more than 2 tables (I'm using Formalchemy for form
generation).
Quick brieffing on my model:
# account table
acc_account_table = sa.Table('acc_account', meta.metadata,
sa.Column('account_id', sa.types.Integer, primary_key=True),
...
# address_book table
acc_address_book_table = sa.Table('acc_address_book', meta.metadata,
sa.Column('address_book_id', sa.types.Integer, primary_key=True),
sa.Column('account_id', sa.types.Integer,
sa.ForeignKey('acc_account.account_id'),
nullable=False),
...
# user table
acc_user_table = sa.Table('acc_user', meta.metadata,
sa.Column('user_id', sa.types.Integer, primary_key=True),
sa.Column('account_id', sa.types.Integer,
sa.ForeignKey('acc_account.account_id')),
...
When i try mapper with 2 table join like:
orm.mapper(AccAccountUser, orm.join(acc_account_table,
acc_user_table),
properties={ 'account_id': [
acc_account_table.c.account_id,
acc_user_table.c.account_id]
})
Then it work ok but i want also to include data from third table
address_book which has also foreign_key to account table so i definied
next mapper which should give me the data from those 3 tables for
Formalchemy:
orm.mapper(AccAccountUserAddress, orm.join(acc_account_table,
acc_user_table,
acc_address_book_table),
properties={ 'account_id': [
acc_account_table.c.account_id,
acc_user_table.c.account_id,
acc_address_book_table.c.account_id]
})
but it gives me error: sqlalchemy.exc.ArgumentError: Column
'acc_address_book.account_id' is not represented in mapper's table.
Maybe i'm doing something wrong with that second mapper join.
Thanks,
Thomas
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.