MCPcopy Create free account

hub / github.com/tortoise/tortoise-orm / functions

Functions3,850 in github.com/tortoise/tortoise-orm

↓ 12 callersFunction_get_schema_editor
Get the correct backend-specific SchemaEditor for the given connection. Mirrors the factory logic in MigrationExecutor._schema_editor().
tests/migrations/test_operations_real_db.py:41
↓ 12 callersFunction_get_sqlite_default_sql
Helper to get the DEFAULT SQL for a field using the SQLite schema generator.
tests/fields/test_db_default.py:264
↓ 12 callersFunction_init_for_asyncpg
Initialize Tortoise for asyncpg and return SQL statements.
tests/schema/test_generate_schema.py:1028
↓ 12 callersFunction_init_for_psycopg
Initialize Tortoise for psycopg and return SQL statements.
tests/schema/test_generate_schema.py:1534
↓ 12 callersFunction_resolve_expression
( value: Expression | Term | ScalarValue | Sequence[float] | Sequence[int] | str | None, resolve_conte
tortoise/contrib/postgres/search.py:78
↓ 12 callersFunctionassert_sql
Assert SQL matches expected value based on db client type.
tests/contrib/postgres/test_search.py:26
↓ 12 callersMethoddistinct
Make QuerySet distinct. Only makes sense in combination with a ``.values()`` or ``.values_list()`` as it precedes all the fe
tortoise/queryset.py:578
↓ 12 callersFunctionsort_by_pk
(items)
tests/test_source_field.py:18
↓ 11 callersMethod_db_queryset
( cls, using_db: BaseDBAsyncClient | None = None, for_write: bool = False )
tortoise/models.py:1314
↓ 11 callersFunction_init_for_mysql
Initialize Tortoise for MySQL and return SQL statements.
tests/schema/test_generate_schema.py:573
↓ 11 callersFunction_merge_joins
(*joins: Iterable[TableCriterionTuple])
tortoise/contrib/postgres/search.py:74
↓ 11 callersFunction_set_option_list
(model_state: ModelState, key: str, values: list)
tortoise/migrations/operations.py:643
↓ 11 callersMethodapply
( self, state: State, *, dry_run: bool = False, schema_editor: BaseSch
tortoise/migrations/migration.py:36
↓ 11 callersMethodchanges
(self)
tortoise/migrations/autodetector.py:50
↓ 11 callersMethodclear
(self)
tortoise/apps.py:326
↓ 11 callersMethodforce_index
The FORCE INDEX hint acts like USE INDEX (index_list), with the addition that a table scan is assumed to be very expensive.
tortoise/queryset.py:993
↓ 11 callersFunctionget_default_timezone
Return the default time zone as a tzinfo instance. This is the time zone defined by Tortoise config.
tortoise/timezone.py:73
↓ 11 callersMethodget_model_state
(state: State, app_label: str, model_name: str)
tortoise/migrations/operations.py:102
↓ 11 callersFunctionrender_value
(value: Any, imports: ImportManager)
tortoise/migrations/writer.py:121
↓ 11 callersMethoduse_index
The USE INDEX (index_list) hint tells MySQL to use only one of the named indexes to find rows in the table.
tortoise/queryset.py:1005
↓ 10 callersMethod__init__
(self, model: type[MODEL])
tortoise/queryset.py:348
↓ 10 callersMethod_constraint_name_for_model
(self, model: type[Model], constraint: UniqueConstraint)
tortoise/migrations/schema_editor/base.py:743
↓ 10 callersMethod_escape_comment
(self, comment: str)
tortoise/migrations/schema_editor/base.py:146
↓ 10 callersFunction_make_model
(name: str, app_label: str, **model_fields: Field)
tests/migrations/test_autodetector.py:73
↓ 10 callersFunction_write_migration
( tmp_path: Path, monkeypatch, name: str, operations, expected: str, )
tests/migrations/test_writer.py:47
↓ 10 callersMethodadd_from
(self, module: str, name: str)
tortoise/migrations/writer.py:72
↓ 10 callersMethodbulk_update
Update the given fields in each of the given objects in the database. This method efficiently updates the given fields on the provide
tortoise/models.py:1391
↓ 10 callersMethodexclude
Generates a QuerySet with the exclude applied. :param args: Q functions containing constraints. Will be AND'ed. :param kwarg
tortoise/models.py:1531
↓ 10 callersMethodget_sql
(self, _context=None, dialect: str | None = None)
tortoise/migrations/expressions.py:8
↓ 10 callersMethodinit
Initialize this context with database configuration. You can configure using one of: ``config``, ``config_file``, or ``(db_url, modu
tortoise/context.py:259
↓ 10 callersMethodreload_model
(self, app_label: str, model_name: str)
tortoise/migrations/schema_generator/state.py:178
↓ 10 callersMethodselect_related
Return a new QuerySet instance that will select related objects. If fields are specified, they must be ForeignKey fields and only th
tortoise/queryset.py:980
↓ 10 callersMethodvalidate
Validate whether given value is valid :param value: Value to be validation :raises ValidationError: If validator check is no
tortoise/fields/base.py:327
↓ 9 callersMethod__await__
(self)
tortoise/queryset.py:1244
↓ 9 callersMethod_choose_db
Return the connection that will be used if this query is executed now. :param for_write: Whether this query for write. :retu
tortoise/models.py:1255
↓ 9 callersMethod_get_field_sql
( self, db_field: str, field_type: str, nullable: bool, unique: bool,
tortoise/migrations/schema_editor/base.py:97
↓ 9 callersFunction_reset_tortoise
Helper to reset Tortoise state before each test. Note: We MUST NOT set Tortoise.apps = None or Tortoise._inited = False because these are cla
tests/model_setup/test_bad_relation_reference.py:12
↓ 9 callersMethod_run_sql
Execute DDL SQL on SQLite. In atomic mode, uses execute_query() per statement because sqlite3.executescript() issues an implicit COMM
tortoise/migrations/schema_editor/sqlite.py:33
↓ 9 callersFunction_teardown_tortoise
Helper to teardown Tortoise state after each test.
tests/model_setup/test_bad_relation_reference.py:43
↓ 9 callersFunction_topological_sort_models
Sort models so children come before parents (safe delete order). Uses Kahn's algorithm on FK dependencies. Models that depend on others via F
tortoise/contrib/test/__init__.py:121
↓ 9 callersMethodadd_constraint
( self, model: type[Model], constraint: UniqueConstraint | CheckConstraint )
tortoise/migrations/schema_editor/base.py:842
↓ 9 callersMethodas_string
(self)
tortoise/migrations/writer.py:285
↓ 9 callersMethodclone
Create a new clone of the object that when you do a ``.save()`` will create a new record. :param pk: An optionally required value if
tortoise/models.py:918
↓ 9 callersMethodclose
(self)
tortoise/backends/odbc/client.py:114
↓ 9 callersMethodclose_connections
Close all connections cleanly. It is required for this to be called on exit, else your event loop may never complete
tortoise/__init__.py:486
↓ 9 callersMethoddeconstruct
(self)
tortoise/indexes.py:57
↓ 9 callersFunctiongenerate_config
( db_url: str, app_modules: dict[str, Iterable[str | ModuleType]], connection_label: str | None =
tortoise/backends/base/config_generator.py:221
↓ 9 callersMethodlast
Generates a QuerySet that returns the last record.
tortoise/models.py:1496
↓ 9 callersMethodremove_constraint
( self, model: type[Model], constraint: UniqueConstraint | CheckConstraint )
tortoise/migrations/schema_editor/base.py:877
↓ 9 callersMethodresolve
(self, resolve_context: ResolveContext)
tortoise/contrib/postgres/search.py:453
↓ 9 callersMethodto_python_value
Converts from the DB type to the Python type. :param value: Value from DB
tortoise/fields/base.py:317
↓ 8 callersMethod__setattr__
(self, key, value)
tortoise/models.py:762
↓ 8 callersMethod_drop_databases
Tries to drop all databases provided in config passed to ``.init()`` method. Normally should be used only for testing purposes.
tortoise/__init__.py:529
↓ 8 callersMethod_escape_comment
(self, comment: str)
tortoise/backends/base/schema_generator.py:125
↓ 8 callersMethod_escape_default_value
(self, default: object)
tortoise/migrations/schema_editor/base.py:149
↓ 8 callersFunction_index_signature
Return a hashable identity tuple for an Index (ignoring its name).
tortoise/migrations/schema_generator/state_diff.py:45
↓ 8 callersFunction_load_config
Load Tortoise ORM configuration from various sources. Returns: TortoiseConfig: Validated configuration object
tortoise/cli/cli.py:171
↓ 8 callersFunction_make_test_editor
Create a BaseSchemaEditor subclass with a FakeClient for testing.
tests/fields/test_db_default.py:401
↓ 8 callersFunction_write_migration
( tmp_path: Path, app_label: str, name: str, dependencies: list[tuple[str, str]] | None = None
tests/migrations/test_autodetector.py:26
↓ 8 callersMethodbuild_graph
(self)
tortoise/migrations/loader.py:73
↓ 8 callersMethodclone
(self)
tortoise/migrations/schema_generator/state.py:218
↓ 8 callersFunctionget_connection
Get a database connection by alias from the current context. This is a convenience function. Prefer accessing connections directly via c
tortoise/connection.py:315
↓ 8 callersMethodget_or_create
Fetches the object if exists (filtering on the provided parameters), else creates an instance with any unspecified parameters as defa
tortoise/models.py:1269
↓ 8 callersMethodresolve_filters
Builds the common filters for a QuerySet.
tortoise/queryset.py:134
↓ 8 callersMethodresolve_ordering
Applies standard ordering to QuerySet. :param model: The Model this queryset is based on. :param table: ``pypika_tortoise.Ta
tortoise/queryset.py:191
↓ 8 callersFunctiontruncate_all_models
Truncate all models in the current context. This is a utility function for test cleanup that deletes all rows from all registered model
tortoise/contrib/test/__init__.py:69
↓ 8 callersMethodupdate_or_create
A convenience method for updating an object with the given kwargs, creating a new one if necessary. :param defaults: Default values
tortoise/models.py:1340
↓ 8 callersMethodusing_db
Executes query in provided db client. Useful for transactions workaround.
tortoise/queryset.py:1066
↓ 7 callersMethod_init_relations
Override to gracefully skip relations whose target model hasn't been registered yet. This happens when ``CreateModel`` operations are sorted
tortoise/migrations/schema_generator/state_apps.py:41
↓ 7 callersFunction_write_migrations
( tmp_path: Path, app_label: str, migrations: list[tuple[str, list[tuple[str, str]]]] )
tests/migrations/test_runtime_migrations.py:37
↓ 7 callersMethodadd_module
(self, module: str)
tortoise/migrations/writer.py:75
↓ 7 callersMethoddatabase_forward
( self, app_label: str, old_state: State, new_state: State, state_edit
tortoise/migrations/operations.py:522
↓ 7 callersMethodexecute_query
Executes a RAW SQL query statement, and returns the resultset. :param query: The SQL string, pre-parametrized for the target DB dial
tortoise/backends/base/client.py:206
↓ 7 callersMethodget_queryset
(self)
tortoise/manager.py:18
↓ 7 callersFunctionget_use_tz
Get use_tz from env set in Tortoise config.
tortoise/timezone.py:44
↓ 7 callersMethodleaf_nodes
(self, app_label: str | None = None)
tortoise/migrations/graph.py:121
↓ 7 callersMethodparameter
(self, pos: int)
tortoise/backends/base/executor.py:186
↓ 7 callersMethodresolve_expressions
(self, model: type[Model])
tortoise/indexes.py:84
↓ 7 callersMethodsplit_reference
(self, reference: str | type[Model])
tortoise/migrations/schema_generator/state_apps.py:120
↓ 6 callersFunctionCharEnumField
Char Enum Field A field representing a character enumeration. **Warning**: If ``max_length`` is not specified or equals to zero, the si
tortoise/fields/data.py:981
↓ 6 callersFunctionManyToManyField
ManyToMany relation field. This field represents a many-to-many between this model and another model. See :ref:`many_to_many` for usage
tortoise/fields/relational.py:586
↓ 6 callersMethod__enter__
Enter the context manager and set this context as current. Returns: This context instance.
tortoise/context.py:487
↓ 6 callersMethod__init__
( self, remote_model: type[MODEL], relation_field: str, instance: Model,
tortoise/fields/relational.py:38
↓ 6 callersFunction_bench
()
tests/benchmarks/test_hydration.py:20
↓ 6 callersMethod_generate_index_name
(self, prefix: str, model: type[Model], field_names: list[str])
tortoise/migrations/schema_editor/base.py:167
↓ 6 callersMethod_get_context
Get the current context from context var.
tortoise/__init__.py:88
↓ 6 callersMethod_init
(self, db_config: DBConfigType, create_db: bool)
tortoise/connection.py:80
↓ 6 callersFunction_prepare_migration_package
(tmp_path: Path, app_label: str)
tests/migrations/test_writer.py:38
↓ 6 callersMethodacquire_connection
(self)
tortoise/backends/mysql/client.py:181
↓ 6 callersMethodacquire_connection
(self)
tortoise/backends/sqlite/client.py:122
↓ 6 callersMethodadd_dependency
( self, migration: MigrationKey, child: MigrationKey, parent: MigrationKey,
tortoise/migrations/graph.py:83
↓ 6 callersMethodadd_node
(self, key: MigrationKey, migration: Migration)
tortoise/migrations/graph.py:71
↓ 6 callersMethodapplied_migrations
(self)
tortoise/migrations/recorder.py:64
↓ 6 callersMethodclose_all
Closes all connections in the storage in the `current context`. All closed connections will be removed from the storage by default.
tortoise/connection.py:264
↓ 6 callersFunctioncreate_participants
Helper to create race participants for tests.
tests/fields/test_subclass.py:11
↓ 6 callersMethoddiscard
Discards the given alias from the storage in the `current context`. :param conn_alias: The alias for which the connection object sho
tortoise/connection.py:217
↓ 6 callersMethoddumps
(cls, obj: Any)
tests/testmodels.py:374
↓ 6 callersFunctionescape_like
(val: str)
tortoise/filters.py:58
↓ 6 callersFunctionescape_like
(val: str)
tortoise/backends/mysql/executor.py:52
↓ 6 callersMethodforwards_plan
(self, target: MigrationKey)
tortoise/migrations/graph.py:129
← previousnext →101–200 of 3,850, ranked by callers