Title: Improve error message for missing @schema decorator · Issue #466 · datajoint/datajoint-python · GitHub
Open Graph Title: Improve error message for missing @schema decorator · Issue #466 · datajoint/datajoint-python
X Title: Improve error message for missing @schema decorator · Issue #466 · datajoint/datajoint-python
Description: If you forget to decorate a datajoint class with its schema, the error message is now more cryptic than it used to be. class Mouse(dj.Manual): definition = """ mouse_id : int ---- dob : date sex : enum('M', 'F', 'unknown') """ pass Mouse...
Open Graph Description: If you forget to decorate a datajoint class with its schema, the error message is now more cryptic than it used to be. class Mouse(dj.Manual): definition = """ mouse_id : int ---- dob : date sex : ...
X Description: If you forget to decorate a datajoint class with its schema, the error message is now more cryptic than it used to be. class Mouse(dj.Manual): definition = """ mouse_id : int ---- do...
Opengraph URL: https://github.com/datajoint/datajoint-python/issues/466
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Improve error message for missing @schema decorator","articleBody":"If you forget to decorate a datajoint class with its schema, the error message is now more cryptic than it used to be.\r\n\r\n```python\r\nclass Mouse(dj.Manual):\r\n definition = \"\"\"\r\n mouse_id : int \r\n ----\r\n dob : date \r\n sex : enum('M', 'F', 'unknown')\r\n \"\"\"\r\n pass\r\n\r\nMouse()\r\n```\r\n```\r\n---------------------------------------------------------------------------\r\nAttributeError Traceback (most recent call last)\r\n/opt/conda/lib/python3.6/site-packages/IPython/core/formatters.py in __call__(self, obj)\r\n 700 type_pprinters=self.type_printers,\r\n 701 deferred_pprinters=self.deferred_printers)\r\n--\u003e 702 printer.pretty(obj)\r\n 703 printer.flush()\r\n 704 return stream.getvalue()\r\n\r\n/opt/conda/lib/python3.6/site-packages/IPython/lib/pretty.py in pretty(self, obj)\r\n 393 if callable(meth):\r\n 394 return meth(obj, self, cycle)\r\n--\u003e 395 return _default_pprint(obj, self, cycle)\r\n 396 finally:\r\n 397 self.end_group()\r\n\r\n/opt/conda/lib/python3.6/site-packages/IPython/lib/pretty.py in _default_pprint(obj, p, cycle)\r\n 508 if _safe_getattr(klass, '__repr__', None) is not object.__repr__:\r\n 509 # A user-provided repr. Find newlines and replace them with p.break_()\r\n--\u003e 510 _repr_pprint(obj, p, cycle)\r\n 511 return\r\n 512 p.begin_group(1, '\u003c')\r\n\r\n/opt/conda/lib/python3.6/site-packages/IPython/lib/pretty.py in _repr_pprint(obj, p, cycle)\r\n 699 \"\"\"A pprint that just redirects to the normal repr function.\"\"\"\r\n 700 # Find newlines and replace them with p.break_()\r\n--\u003e 701 output = repr(obj)\r\n 702 for idx,output_line in enumerate(output.splitlines()):\r\n 703 if idx:\r\n\r\n/opt/conda/lib/python3.6/site-packages/datajoint/relational_operand.py in __repr__(self)\r\n 345 \r\n 346 def __repr__(self):\r\n--\u003e 347 return super().__repr__() if config['loglevel'].lower() == 'debug' else self.preview()\r\n 348 \r\n 349 def preview(self, limit=None, width=None):\r\n\r\n/opt/conda/lib/python3.6/site-packages/datajoint/relational_operand.py in preview(self, limit, width)\r\n 351 returns a preview of the contents of the relation.\r\n 352 \"\"\"\r\n--\u003e 353 heading = self.heading\r\n 354 rel = self.proj(*heading.non_blobs)\r\n 355 if limit is None:\r\n\r\n/opt/conda/lib/python3.6/site-packages/datajoint/base_relation.py in heading(self)\r\n 43 self._heading = Heading() # instance-level heading\r\n 44 if not self._heading: # lazy loading of heading\r\n---\u003e 45 self._heading.init_from_database(self.connection, self.database, self.table_name)\r\n 46 return self._heading\r\n 47 \r\n\r\n/opt/conda/lib/python3.6/site-packages/datajoint/heading.py in init_from_database(self, conn, database, table_name)\r\n 132 initialize heading from a database table. The table must exist already.\r\n 133 \"\"\"\r\n--\u003e 134 info = conn.query('SHOW TABLE STATUS FROM `{database}` WHERE name=\"{table_name}\"'.format(\r\n 135 table_name=table_name, database=database), as_dict=True).fetchone()\r\n 136 if info is None:\r\n\r\nAttributeError: 'NoneType' object has no attribute 'query'\r\n\r\n---------------------------------------------------------------------------\r\nAttributeError Traceback (most recent call last)\r\n/opt/conda/lib/python3.6/site-packages/IPython/core/formatters.py in __call__(self, obj)\r\n 343 method = get_real_method(obj, self.print_method)\r\n 344 if method is not None:\r\n--\u003e 345 return method()\r\n 346 return None\r\n 347 else:\r\n\r\n/opt/conda/lib/python3.6/site-packages/datajoint/relational_operand.py in _repr_html_(self)\r\n 373 \r\n 374 def _repr_html_(self):\r\n--\u003e 375 heading = self.heading\r\n 376 rel = self.proj(*heading.non_blobs)\r\n 377 info = heading.table_info\r\n\r\n/opt/conda/lib/python3.6/site-packages/datajoint/base_relation.py in heading(self)\r\n 43 self._heading = Heading() # instance-level heading\r\n 44 if not self._heading: # lazy loading of heading\r\n---\u003e 45 self._heading.init_from_database(self.connection, self.database, self.table_name)\r\n 46 return self._heading\r\n 47 \r\n\r\n/opt/conda/lib/python3.6/site-packages/datajoint/heading.py in init_from_database(self, conn, database, table_name)\r\n 132 initialize heading from a database table. The table must exist already.\r\n 133 \"\"\"\r\n--\u003e 134 info = conn.query('SHOW TABLE STATUS FROM `{database}` WHERE name=\"{table_name}\"'.format(\r\n 135 table_name=table_name, database=database), as_dict=True).fetchone()\r\n 136 if info is None:\r\n\r\nAttributeError: 'NoneType' object has no attribute 'query'\r\n```","author":{"url":"https://github.com/dimitri-yatsenko","@type":"Person","name":"dimitri-yatsenko"},"datePublished":"2018-04-19T17:48:45.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/466/datajoint-python/issues/466"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:bfad03f9-fbe1-9bcf-864f-f10b0d3da1f2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B7B6:14011B:15CD6C6:1DA7E04:6A4F0250 |
| html-safe-nonce | 3764466488ed3660896698590dcfc03f0328f942d3b2f81a2ef6294b1dc4d412 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCN0I2OjE0MDExQjoxNUNENkM2OjFEQTdFMDQ6NkE0RjAyNTAiLCJ2aXNpdG9yX2lkIjoiNTIxMzM4NzMxMTc2NTQ1NTQ0MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c1b20b5bc6f5f415d524c44803b1cb0326ecc6ef5b32b53a011d3c3dac67ebe8 |
| hovercard-subject-tag | issue:315976842 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/datajoint/datajoint-python/466/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6a92489c03baf31abdcc254806c6d807b0e26131fdbc19a101a700b5d3914a48/datajoint/datajoint-python/issues/466 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6a92489c03baf31abdcc254806c6d807b0e26131fdbc19a101a700b5d3914a48/datajoint/datajoint-python/issues/466 |
| og:image:alt | If you forget to decorate a datajoint class with its schema, the error message is now more cryptic than it used to be. class Mouse(dj.Manual): definition = """ mouse_id : int ---- dob : date sex : ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dimitri-yatsenko |
| hostname | github.com |
| expected-hostname | github.com |
| None | b92d11c0aa4a77d54ef4af1078b6a15fb5a70a215b30c4ecf28889d5a8e656d9 |
| turbo-cache-control | no-preview |
| go-import | github.com/datajoint/datajoint-python git https://github.com/datajoint/datajoint-python.git |
| octolytics-dimension-user_id | 2375501 |
| octolytics-dimension-user_login | datajoint |
| octolytics-dimension-repository_id | 5866704 |
| octolytics-dimension-repository_nwo | datajoint/datajoint-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 5866704 |
| octolytics-dimension-repository_network_root_nwo | datajoint/datajoint-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2b8f23afb982271f1b22258a94aede67a6b77760 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width