-
Notifications
You must be signed in to change notification settings - Fork 93
Closed
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behavior
Description
Bug Report
Description
Calling class methods, properties, or instance methods derived from parent classes of UserTable creates inconsistent and confusing error messages when schema is not activated for a set of tables.
import datajoint as dj
dj.config["loglevel"] = "INFO"
schema = dj.Schema()
@schema
class TableA(dj.Manual):
definition = """
# TableA example
table_a : UUID
---
label : VARCHAR(100)
"""
# printing of some properties is ok:
print(TableA.definition) # ok -> No error.
# # TableA example
# table_a : UUID
# ---
# label : VARCHAR(100)
# Error description is valid for these cases:
TableA().describe() # ok -> DataJointError: Class TableA is not properly declared (schema decorator not applied?)
TableA.describe() # ok -> DataJointError: Class TableA is not properly declared (schema decorator not applied?)
# Uninformative error:
TableA() # bad -> AttributeError: 'NoneType' object has no attribute 'non_blobs'
# Additional situations of inconsistent errors when printing from an non-activated `Table`.
@schema
class TableB(dj.Manual):
definition = """
thing : INT
----
label : VARCHAR(200)
"""
instance = TableB()
# ok -> no error
print(TableB.definition)
# thing : INT
# ---
# label : VARCHAR(200)
# preview.py:51, AttributeError: 'NoneType' object has no attribute 'non_blobs'
instance
# condition.py:154, AttributeError: 'NoneType' object has no attribute 'names'
instance & {}
# expression.py:96, AttributeError: 'NoneType' object has no attribute 'primary_key'
instance.fetch("KEY")
# expression.py:96, AttributeError: 'NoneType' object has no attribute 'primary_key'
instance.head()
TableB.head()
# condition.py:75, AttributeError: 'NoneType' object has no attribute 'secondary_attributes'
TableB & TableA
# issues with `__repr__`` and `_repr_html_`
# preview.py:8, AttributeError: 'NoneType' object has no attribute 'non_blobs'
instance.head
TableB.head
dj.config["loglevel"] = "DEBUG"
# ok -> <bound method QueryExpression.head of <__main__.TableB object at 0x1231b3cd0>>
instance.head
# diff error than before (closer to indication about activation) -> # expression.py:96, AttributeError: 'NoneType' object has no attribute 'primary_key'
instance.head()Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behavior