datajoint-python
datajoint-python copied to clipboard
`current_timestamp()` not treated as sql literal
trafficstars
Bug Report
Description
@schema
class Table(dj.Manual):
definition = """
t = CURRENT_TIMESTAMP : timestamp
"""
@schema # pymysql.err.OperationalError: (1067, "Invalid default value for 't'")
class Copy(dj.Manual):
definition = (Table().heading) # or 'Table().describe()'
In my case the server returns current_timestamp() as the default value for t but that value is not treated as a sql literal by datajoint. Therefore datajoint surrounds the value with quotation marks making it an invalid default value and leading to the error. One fix is to add current_timestamp() to the list of literals here. I would be happy to make a PR if you agree with that fix.
Reproducibility
- DataJoint Version 0.14.1
- MariaDB Version 10.3.38
This doesn't happen when using mysql 5.7.33.