MS-SQL reflection does not pick up primary key

Issue #317 resolved
Former user created an issue

Setup

  • SQLAlchemy 0.2.8 (tried trunk as well with same result)
  • MS SQL Server 2005 Express
  • pymssql

I have two simple tables which are defined in the database already:

property(pk=PropertyID)
deal(pk=DealID, fk=property.c.PropertyID)

I am using reflection to build OR and would expect mapper to pick up PK, but instead I get the following error:

sqlalchemy.exceptions.ArgumentError: Could not assemble any primary key columns
for mapped table 'property'

Comments (8)

  1. Former user Account Deleted

    (original author: ram) Fixed in r#1913

    Note that you'll need to modify your program slightly to work -- the table names in the DDL are spelled 'Property' and 'Deal', while your program refers to them as 'property' and 'deal' -- MS-SQL is case-sensitive, so you'll need to change lines 8 & 9 in your testcase to match the DB table names.

  2. Log in to comment