7676 TEMPORAL = r"(time|timestamp|year)(\s*\(.+\))?$" , # time, timestamp, year (not date/datetime)
7777 NATIVE_BLOB = r"(tiny|small|medium|long)blob$" , # Specific blob variants
7878 NATIVE_TEXT = r"(tiny|small|medium|long)text$" , # Text variants (use plain 'text' instead)
79- # AttributeTypes use angle brackets
80- ADAPTED = r"<.+>$" ,
79+ # Codecs use angle brackets
80+ CODEC = r"<.+>$" ,
8181 ).items ()
8282}
8383
8484# Core types are stored in attribute comment for reconstruction
8585CORE_TYPE_NAMES = {name .upper () for name in CORE_TYPES }
8686
8787# Special types that need comment storage (core types + adapted)
88- SPECIAL_TYPES = CORE_TYPE_NAMES | {"ADAPTED " }
88+ SPECIAL_TYPES = CORE_TYPE_NAMES | {"CODEC " }
8989
9090# Native SQL types that pass through (with optional warning)
9191NATIVE_TYPES = set (TYPE_PATTERN ) - SPECIAL_TYPES
@@ -104,23 +104,6 @@ def match_type(attribute_type):
104104logger = logging .getLogger (__name__ .split ("." )[0 ])
105105
106106
107- def build_foreign_key_parser_old ():
108- # old-style foreign key parser. Superseded by expression-based syntax. See issue #436
109- # This will be deprecated in a future release.
110- left = pp .Literal ("(" ).suppress ()
111- right = pp .Literal (")" ).suppress ()
112- attribute_name = pp .Word (pp .srange ("[a-z]" ), pp .srange ("[a-z0-9_]" ))
113- new_attrs = pp .Optional (left + pp .DelimitedList (attribute_name ) + right ).set_results_name ("new_attrs" )
114- arrow = pp .Literal ("->" ).suppress ()
115- lbracket = pp .Literal ("[" ).suppress ()
116- rbracket = pp .Literal ("]" ).suppress ()
117- option = pp .Word (pp .srange ("[a-zA-Z]" ))
118- options = pp .Optional (lbracket + pp .DelimitedList (option ) + rbracket ).set_results_name ("options" )
119- ref_table = pp .Word (pp .alphas , pp .alphanums + "._" ).set_results_name ("ref_table" )
120- ref_attrs = pp .Optional (left + pp .DelimitedList (attribute_name ) + right ).set_results_name ("ref_attrs" )
121- return new_attrs + arrow + options + ref_table + ref_attrs
122-
123-
124107def build_foreign_key_parser ():
125108 arrow = pp .Literal ("->" ).suppress ()
126109 lbracket = pp .Literal ("[" ).suppress ()
@@ -144,7 +127,6 @@ def build_attribute_parser():
144127 return attribute_name + pp .Optional (default ) + colon + data_type + comment
145128
146129
147- foreign_key_parser_old = build_foreign_key_parser_old ()
148130foreign_key_parser = build_foreign_key_parser ()
149131attribute_parser = build_attribute_parser ()
150132
@@ -459,14 +441,14 @@ def substitute_special_type(match, category, foreign_key_sql, context):
459441
460442 Special types are:
461443 - Core DataJoint types (float32 → float, uuid → binary(16), bytes → longblob, etc.)
462- - ADAPTED types (AttributeTypes in angle brackets)
444+ - CODEC types (Codecs in angle brackets)
463445
464446 :param match: dict containing with keys "type" and "comment" -- will be modified in place
465447 :param category: attribute type category from TYPE_PATTERN
466448 :param foreign_key_sql: list of foreign key declarations to add to
467449 :param context: context for looking up user-defined codecs (unused, kept for compatibility)
468450 """
469- if category == "ADAPTED " :
451+ if category == "CODEC " :
470452 # Codec - resolve to underlying dtype
471453 codec , store_name = lookup_codec (match ["type" ])
472454 if store_name is not None :
@@ -540,7 +522,7 @@ def compile_attribute(line, in_key, foreign_key_sql, context):
540522 category = match_type (match ["type" ])
541523
542524 if category in SPECIAL_TYPES :
543- # Core types and AttributeTypes are recorded in comment for reconstruction
525+ # Core types and Codecs are recorded in comment for reconstruction
544526 match ["comment" ] = ":{type}:{comment}" .format (** match )
545527 substitute_special_type (match , category , foreign_key_sql , context )
546528 elif category in NATIVE_TYPES :
0 commit comments