Get current table structure of the database
(engine)
| 43 | return create_engine(conn_str) |
| 44 | |
| 45 | def get_db_schema(engine): |
| 46 | """Get current table structure of the database""" |
| 47 | inspector = sqlalchemy_inspect(engine) |
| 48 | schema = {} |
| 49 | for table_name in inspector.get_table_names(): |
| 50 | columns = {} |
| 51 | for column in inspector.get_columns(table_name): |
| 52 | columns[column['name']] = str(column['type']) |
| 53 | schema[table_name] = columns |
| 54 | return schema |
| 55 | |
| 56 | def get_orm_schema(): |
| 57 | """Get table structure of ORM model""" |