address varchar(255) [unique, not null, note: 'to include unit number']
(s, loc, tok)
| 113 | |
| 114 | |
| 115 | def 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 | |
| 143 | table_column.set_parse_action(parse_column) |
nothing calls this directly
no test coverage detected