Get table structure of ORM model
()
| 54 | return schema |
| 55 | |
| 56 | def get_orm_schema(): |
| 57 | """Get table structure of ORM model""" |
| 58 | schema = {} |
| 59 | for table_name, table in Base.metadata.tables.items(): |
| 60 | columns = {} |
| 61 | for column in table.columns: |
| 62 | columns[column.name] = str(column.type) |
| 63 | schema[table_name] = columns |
| 64 | return schema |
| 65 | |
| 66 | def compare_schemas(db_schema, orm_schema): |
| 67 | """Compare database structure with ORM model structure and return differences""" |