Niyas wrote: > Dear All, > > In my application, i have a master table and a details table. In the > details table > containes foreign key only no primary key. I will be getting the > following > error while running. > > ArgumentError: Mapper Mapper|LpoIssueDetails|tbl_lpo_issue_details > could not assemble any primary key columns for mapped table > 'tbl_lpo_issue_details' > > > Is it must a Primary key in the details table.? > > Thanks in advance. > > Regards, > Niyas >
SQLAlchemy mappers require some sort of key to map rows to instances. The key that it uses does not have to be the primary key of the table you are using: any set of columns usable for a unique constraint would work. See the "allow_null_pks" and "primary_key" mapper args at http://www.sqlalchemy.org/docs/05/reference/orm/mapping.html#defining-mappings for more details. BTW, is there a reason you cannot make your foreign key column also be the primary key? -Conor --~--~---------~--~----~------------~-------~--~----~ 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 options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---