Bug Report
Description
When there is complex expression in restrictor string, the query does not get parsed correctly.
Reproducibility
Include:
- OS: MACOS and Linux
- Python Version 3.8 & 3.7
- MySQL Deployment Strategy: local-native and remote
- DataJoint Version: 0.13.0
Code to reproduce:
schema = dj.schema('test')
@schema
class Session(dj.Manual):
definition = """
session_date : varchar(8)
"""
Session & 'session_date between curdate() - interval 30 day and curdate()'
gives error:
---------------------------------------------------------------------------
DataJointError Traceback (most recent call last)
<ipython-input-9-aff0f5e74045> in <module>
----> 1 Session & 'session_date between curdate() - interval 30 day and curdate()'
~/anaconda3/lib/python3.7/site-packages/datajoint/user_tables.py in __and__(cls, arg)
31
32 def __and__(cls, arg):
---> 33 return cls() & arg
34
35 def __xor__(cls, arg):
~/anaconda3/lib/python3.7/site-packages/datajoint/expression.py in __and__(self, restriction)
198 See QueryExpression.restrict for more detail.
199 """
--> 200 return self.restrict(restriction)
201
202 def __xor__(self, restriction):
~/anaconda3/lib/python3.7/site-packages/datajoint/expression.py in restrict(self, restriction)
173 try:
174 raise DataJointError("Attribute `%s` is not found in query." % next(
--> 175 attr for attr in attributes if attr not in self.heading.names))
176 except StopIteration:
177 pass # all ok
DataJointError: Attribute `day` is not found in query.
This used to work in dj 0.12.