test reflection of a composite primary key
(self, connection, metadata)
| 1102 | ) |
| 1103 | |
| 1104 | def test_composite_pks(self, connection, metadata): |
| 1105 | """test reflection of a composite primary key""" |
| 1106 | |
| 1107 | conn = connection |
| 1108 | conn.exec_driver_sql(""" |
| 1109 | CREATE TABLE book ( |
| 1110 | id INTEGER NOT NULL, |
| 1111 | isbn VARCHAR(50) NOT NULL, |
| 1112 | title VARCHAR(100) NOT NULL, |
| 1113 | series INTEGER NOT NULL, |
| 1114 | series_id INTEGER NOT NULL, |
| 1115 | UNIQUE(series, series_id), |
| 1116 | PRIMARY KEY(id, isbn) |
| 1117 | )""") |
| 1118 | book = Table("book", metadata, autoload_with=connection) |
| 1119 | assert book.primary_key.contains_column(book.c.id) |
| 1120 | assert book.primary_key.contains_column(book.c.isbn) |
| 1121 | assert not book.primary_key.contains_column(book.c.series) |
| 1122 | eq_(len(book.primary_key), 2) |
| 1123 | |
| 1124 | def test_composite_fk(self, connection, metadata): |
| 1125 | """test reflection of composite foreign keys""" |
nothing calls this directly
no test coverage detected