Open shenshan opened 3 years ago
{} is not supported in attribute comments
{}
@schema class Session(dj.Manual): definition = """ -> Subject session_start_time: datetime --- session_dir='' : varchar(32) # {session_directory} """
--------------------------------------------------------------------------- KeyError Traceback (most recent call last) <ipython-input-21-23a07d7508ab> in <module> 1 @schema ----> 2 class Session(dj.Manual): 3 definition = """ 4 -> Subject 5 session_start_time: datetime ~/anaconda3/lib/python3.7/site-packages/datajoint/schemas.py in __call__(self, cls, context) 145 raise DataJointError('The schema decorator should not be applied to Part relations') 146 if self.is_activated(): --> 147 self._decorate_master(cls, context) 148 else: 149 self.declare_list.append((cls, context)) ~/anaconda3/lib/python3.7/site-packages/datajoint/schemas.py in _decorate_master(self, cls, context) 155 :param context: the class' declaration context 156 """ --> 157 self._decorate_table(cls, context=dict(context, self=cls, **{cls.__name__: cls})) 158 # Process part tables 159 for part in ordered_dir(cls): ~/anaconda3/lib/python3.7/site-packages/datajoint/schemas.py in _decorate_table(self, table_class, context, assert_declared) 186 if not self.create_tables or assert_declared: 187 raise DataJointError('Table `%s` not declared' % instance.table_name) --> 188 instance.declare(context) 189 is_declared = is_declared or instance.is_declared 190 ~/anaconda3/lib/python3.7/site-packages/datajoint/table.py in declare(self, context) 78 'e.g. from inside a populate/make call') 79 sql, external_stores = declare(self.full_table_name, self.definition, context) ---> 80 sql = sql.format(database=self.database) 81 try: 82 # declare all external tables before declaring main table KeyError: 'session_directory'
What's the error message?
@dimitri-yatsenko I updated the error above.
Makes sense. DataJoint should escape the curly brackets before incorporating the comment in a formatted string. Easy fix.
Bug Report
Description
{}
is not supported in attribute commentsError