Skip to content

Commit 503a170

Browse files
Table doc strings now display reverse-engineered table declarations
1 parent 41acaa3 commit 503a170

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

datajoint/heading.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,8 @@ def init_from_database(self, conn, database, table_name, context):
247247
category = next(c for c in SPECIAL_TYPES if TYPE_PATTERN[c].match(attr['type']))
248248
except StopIteration:
249249
if attr['type'].startswith('external'):
250-
raise DataJointError('Legacy datatype `{type}`.'.format(**attr)) from None
250+
raise DataJointError('Legacy datatype `{type}`. '
251+
'Migrate your external stores to datajoint 0.12'.format(**attr)) from None
251252
raise DataJointError('Unknown attribute type `{type}`'.format(**attr)) from None
252253
if category == 'FILEPATH' and not _support_filepath_types():
253254
raise DataJointError("""

datajoint/schema.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ def process_table_class(self, table_class, context, assert_declared=False):
193193

194194
# add table definition to the doc string
195195
if isinstance(table_class.definition, str):
196-
table_class.__doc__ = (table_class.__doc__ or "") + "\n\nTable definition:\n\n" + table_class.definition
196+
table_class.__doc__ = ((table_class.__doc__ or "") + "\n\nTable definition:\n"
197+
+ table_class.describe(printout=False))
197198

198199
# fill values in Lookup tables from their contents property
199200
if isinstance(instance, Lookup) and hasattr(instance, 'contents') and is_declared:

0 commit comments

Comments
 (0)