Skip to content

Commit c8d8798

Browse files
restore requirement for a primary key in a table declaration until singular tables are suppported
1 parent 47170bc commit c8d8798

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

datajoint/declare.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,10 @@ def declare(full_table_name, definition, context):
275275

276276
table_comment, primary_key, attribute_sql, foreign_key_sql, index_sql, external_stores = prepare_declare(
277277
definition, context)
278+
279+
if not primary_key:
280+
raise DataJointError('Table must have a primary key')
281+
278282
return (
279283
'CREATE TABLE IF NOT EXISTS %s (\n' % full_table_name +
280284
',\n'.join(attribute_sql + ['PRIMARY KEY (`' + '`,`'.join(primary_key) + '`)'] + foreign_key_sql + index_sql) +

0 commit comments

Comments
 (0)