MCPcopy
hub / github.com/tortoise/tortoise-orm / _schema_editor

Method _schema_editor

tortoise/migrations/executor.py:137–154  ·  view source on GitHub ↗
(self, atomic: bool = True, collect_sql: bool = False)

Source from the content-addressed store, hash-verified

135 progress(event, key.app_label, key.name)
136
137 def _schema_editor(self, atomic: bool = True, collect_sql: bool = False) -> BaseSchemaEditor:
138 module = self.connection.__class__.__module__
139 dialect = self.connection.capabilities.dialect
140 if "sqlite" in module:
141 return SqliteSchemaEditor(self.connection, atomic=atomic, collect_sql=collect_sql)
142 if "asyncpg" in module:
143 return AsyncpgSchemaEditor(self.connection, atomic=atomic, collect_sql=collect_sql)
144 if "psycopg" in module:
145 return PsycopgSchemaEditor(self.connection, atomic=atomic, collect_sql=collect_sql)
146 if "mysql" in module:
147 return MySQLSchemaEditor(self.connection, atomic=atomic, collect_sql=collect_sql)
148 if "mssql" in module or "odbc" in module:
149 return MSSQLSchemaEditor(self.connection, atomic=atomic, collect_sql=collect_sql)
150 if "oracle" in module:
151 return OracleSchemaEditor(self.connection, atomic=atomic, collect_sql=collect_sql)
152 if dialect == "postgres":
153 return BasePostgresSchemaEditor(self.connection, atomic=atomic, collect_sql=collect_sql)
154 return BaseSchemaEditor(self.connection, atomic=atomic, collect_sql=collect_sql)
155
156 async def collect_sql(
157 self,

Callers 2

migrateMethod · 0.95
collect_sqlMethod · 0.95

Calls 8

SqliteSchemaEditorClass · 0.90
AsyncpgSchemaEditorClass · 0.90
PsycopgSchemaEditorClass · 0.90
MySQLSchemaEditorClass · 0.90
MSSQLSchemaEditorClass · 0.90
OracleSchemaEditorClass · 0.90
BaseSchemaEditorClass · 0.90

Tested by

no test coverage detected