Skip to content

Commit d690e54

Browse files
Update parsing.
1 parent 3784439 commit d690e54

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

datajoint/declare.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
UUID_DATA_TYPE = 'binary(16)'
1414
MAX_TABLE_NAME_LENGTH = 64
15-
CONSTANT_LITERALS = {'CURRENT_TIMESTAMP', 'CURRENT_TIMESTAMP(3)'} # SQL literals to be used without quotes (case insensitive)
15+
CONSTANT_LITERALS = {'CURRENT_TIMESTAMP'} # SQL literals to be used without quotes (case insensitive)
1616
EXTERNAL_TABLE_ROOT = '~external'
1717

1818
TYPE_PATTERN = {k: re.compile(v, re.I) for k, v in dict(
@@ -443,7 +443,8 @@ def compile_attribute(line, in_key, foreign_key_sql, context):
443443
match['default'] = 'DEFAULT NULL' # nullable attributes default to null
444444
else:
445445
if match['default']:
446-
quote = match['default'].upper() not in CONSTANT_LITERALS and match['default'][0] not in '"\''
446+
quote = (match['default'].split('(')[0].upper() not in CONSTANT_LITERALS
447+
and match['default'][0] not in '"\'')
447448
match['default'] = 'NOT NULL DEFAULT ' + ('"%s"' if quote else "%s") % match['default']
448449
else:
449450
match['default'] = 'NOT NULL'

0 commit comments

Comments
 (0)