I should have explained that the code-fragment is what I am currently doing in the Sybase driver.
pjjH On Apr 8, 4:54 pm, "phrrn...@googlemail.com" <phrrn...@googlemail.com> wrote: > I am trudging through the unit tests for the Sybase backend and found > an interesting one in test_nonreflected_fk_raises in engine/ > reflection.py. A couple of the drivers look like they skip over the > column if it is not contained within table.c but go ahead and create > the primary_key in any case! This seems a bit odd to me. Is this the > intended behavior? > > pjjH > > # I think we have to raise some kind of exception here if > # we try and reflect on an index when the column is > # omitted from include_columns? > > if include_columns and column_name not in include_columns: > raise exc.NoReferencedColumnError( > "Could not create PrimaryKey/Index '%s' on table > '%s': " > "table '%s' has column named '%s' but it is not > present in include_columns:%s" % ( > index_name, table.name, table.name, > column_name,','.join(include_columns))) > > if r.status & 0x800 == 0x800: > table.primary_key.add(table.c[row[0]]) > if not index_name in PK.keys(): > PK[index_name] = PrimaryKeyConstraint(name = > index_name) > PK[index_name].add(table.c > [column_name]) > else: > if not index_name in INDEXES.keys(): > INDEXES[index_name] = Index(index_name, unique= > (r.status & 0x2 == 0x2)) > INDEXES[index_name].append_column(table.c[column_name]) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---