Skip to content

Commit c329bd0

Browse files
committed
Merge pull request #4 from mrocklin/master
Make reflection robust to tables without primary keys
2 parents a0ae047 + b05f819 commit c329bd0

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

sqlalchemy_monetdb/dialect.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,12 @@ def get_pk_constraint(self, connection, table_name, schema=None, **kw):
369369
args = {"table_id": self._table_id(connection, table_name, schema)}
370370
c = connection.execute(q, args)
371371
table = c.fetchall()
372-
cols = [c[0] for c in table]
373-
name = table[0][1]
374-
return {'constrained_columns': cols, 'name': name}
372+
if table:
373+
cols = [c[0] for c in table]
374+
name = table[0][1]
375+
return {'constrained_columns': cols, 'name': name}
376+
else:
377+
return {}
375378

376379

377380
def get_unique_constraints(self, connection, table_name, schema=None, **kw):

0 commit comments

Comments
 (0)