MCPcopy Create free account
hub / github.com/Vanderhoof/PyDBML / parse_column

Function parse_column

pydbml/definitions/column.py:115–140  ·  view source on GitHub ↗

address varchar(255) [unique, not null, note: 'to include unit number']

(s, loc, tok)

Source from the content-addressed store, hash-verified

113
114
115def parse_column(s, loc, tok):
116 '''
117 address varchar(255) [unique, not null, note: 'to include unit number']
118 '''
119 init_dict = {
120 'name': tok['name'],
121 'type': tok['type'],
122 }
123 # deprecated
124 for constraint in tok.get('constraints', []):
125 if constraint == 'pk':
126 init_dict['pk'] = True
127 elif constraint == 'unique':
128 init_dict['unique'] = True
129
130 if 'settings' in tok:
131 init_dict.update(tok['settings'])
132
133 # comments after column definition have priority
134 if 'comment' in tok:
135 init_dict['comment'] = tok['comment'][0]
136 if 'comment' not in init_dict and 'comment_before' in tok:
137 comment = '\n'.join(c[0] for c in tok['comment_before'])
138 init_dict['comment'] = comment
139
140 return ColumnBlueprint(**init_dict)
141
142
143table_column.set_parse_action(parse_column)

Callers

nothing calls this directly

Calls 2

ColumnBlueprintClass · 0.90
getMethod · 0.80

Tested by

no test coverage detected