upsert ¶
Upsert operations for database controllers.
Classes:
-
UpsertController–Handles upsert and get-or-create operations.
Classes¶
UpsertController ¶
Python
UpsertController(model: type[ModelT], db: DatabaseService)
Handles upsert and get-or-create operations.
Initialize the upsert controller.
Parameters:
-
model(type[ModelT]) –The SQLModel to perform upsert operations on.
-
db(DatabaseService) –The database service instance.
Returned by:
-
afk ClassesAfkController Functions_get_upsert -
base ClassesBaseController Functions_get_upsert -
base_controller ClassesBaseController Functions_get_upsert -
case ClassesCaseController Functions_get_upsert -
controllers Classes-
AfkController Functions_get_upsert -
BaseController Functions_get_upsert -
CaseController Functions_get_upsert -
GuildConfigController Functions_get_upsert -
GuildController Functions_get_upsert -
LevelsController Functions_get_upsert -
PermissionAssignmentController Functions_get_upsert -
PermissionCommandController Functions_get_upsert -
PermissionRankController Functions_get_upsert -
ReminderController Functions_get_upsert -
SnippetController Functions_get_upsert -
StarboardController Functions_get_upsert -
StarboardMessageController Functions_get_upsert
-
-
guild ClassesGuildController Functions_get_upsert -
guild_config ClassesGuildConfigController Functions_get_upsert -
levels ClassesLevelsController Functions_get_upsert -
permissions Classes -
reminder ClassesReminderController Functions_get_upsert -
snippet ClassesSnippetController Functions_get_upsert -
starboard Classes
Methods:
-
upsert_by_field–Upsert a record by a specific field.
-
upsert_by_id–Upsert a record by ID.
-
get_or_create_by_field–Get existing record or create new one by field.
-
get_or_create–Get existing record or create new one.
-
upsert–Upsert a record.
Functions¶
upsert_by_field async ¶
upsert_by_id async ¶
Python
upsert_by_id(
record_id: Any, defaults: dict[str, Any] | None = None, **kwargs: Any
) -> tuple[ModelT, bool]