(fields: FieldMap)
| 70 | |
| 71 | |
| 72 | def gen_columns_sql(fields: FieldMap) -> Iterator[ColumnSchema]: |
| 73 | for name, py_type in fields.items(): |
| 74 | check_identifier(name) |
| 75 | try: |
| 76 | sql_type = SQL_TYPES[py_type] |
| 77 | except KeyError as e: |
| 78 | raise ValueError(f'type {py_type!r} is not supported') from e |
| 79 | yield ColumnSchema(name, sql_type) |
| 80 | |
| 81 | |
| 82 | def make_schema_sql(table_name: str, fields: FieldMap) -> str: |