Skip to content

Commit 95c1c7a

Browse files
postpone dimensionless table implementation until after error refactoring
1 parent 9a6db29 commit 95c1c7a

File tree

3 files changed

+2
-43
lines changed

3 files changed

+2
-43
lines changed

datajoint/declare.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ def compile_foreign_key(line, context, attributes, primary_key, attr_sql, foreig
210210
# declare the foreign key
211211
foreign_key_sql.append(
212212
'FOREIGN KEY (`{fk}`) REFERENCES {ref} (`{pk}`) ON UPDATE CASCADE ON DELETE RESTRICT'.format(
213-
fk='`,`'.join(ref.primary_key) or '_', # dimensionless tables use _ as primary key
214-
pk='`,`'.join(base.primary_key) or '_',
213+
fk='`,`'.join(ref.primary_key),
214+
pk='`,`'.join(base.primary_key),
215215
ref=base.full_table_name))
216216

217217
# declare unique index
@@ -275,12 +275,6 @@ 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-
# singular (dimensionless) table -- can contain only one element
281-
attribute_sql.insert(0, '`_` char(1) not null default "" COMMENT "dimensionless primary key"')
282-
primary_key = ['_']
283-
284278
return (
285279
'CREATE TABLE IF NOT EXISTS %s (\n' % full_table_name +
286280
',\n'.join(attribute_sql + ['PRIMARY KEY (`' + '`,`'.join(primary_key) + '`)'] + foreign_key_sql + index_sql) +

datajoint/heading.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,6 @@ def init_from_database(self, conn, database, table_name):
182182
for k, v in x.items() if k not in fields_to_drop}
183183
for x in attributes]
184184

185-
# exclude attributes that begin with an underscore: these are reserved for DataJoint internals
186-
attributes = [a for a in attributes if not a['name'].startswith('_')]
187-
188185
numeric_types = {
189186
('float', False): np.float64,
190187
('float', True): np.float64,

tests/test_dimensionless.py

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)