MCPcopy Create free account
hub / github.com/NanmiCoder/MediaCrawler / get_db_schema

Function get_db_schema

test/test_db_sync.py:45–54  ·  view source on GitHub ↗

Get current table structure of the database

(engine)

Source from the content-addressed store, hash-verified

43 return create_engine(conn_str)
44
45def 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
56def get_orm_schema():
57 """Get table structure of ORM model"""

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected