MCPcopy
hub / github.com/ormar-orm/ormar / create

Method create

ormar/queryset/queryset.py:1349–1363  ·  view source on GitHub ↗

Creates the model instance, saves it in a database and returns the updates model (with pk populated if not passed and autoincrement is set). The allowed kwargs are `Model` fields names and proper value types. :param kwargs: fields names and proper value types

(self, **kwargs: Any)

Source from the content-addressed store, hash-verified

1347 yield (await self._process_query_result_rows(rows, plan_cache))[0]
1348
1349 async def create(self, **kwargs: Any) -> "T":
1350 """
1351 Creates the model instance, saves it in a database and returns the updates model
1352 (with pk populated if not passed and autoincrement is set).
1353
1354 The allowed kwargs are `Model` fields names and proper value types.
1355
1356 :param kwargs: fields names and proper value types
1357 :type kwargs: Any
1358 :return: created model
1359 :rtype: Model
1360 """
1361 instance = self.model(**kwargs)
1362 instance = await instance.save()
1363 return instance
1364
1365 async def bulk_create(self, objects: list["T"]) -> None:
1366 """

Callers 15

get_or_createMethod · 0.95
update_or_createMethod · 0.95
run_queryFunction · 0.45
run_queryFunction · 0.45
run_queryFunction · 0.45
run_queryFunction · 0.45
run_queryFunction · 0.45
run_queryFunction · 0.45
run_queryFunction · 0.45
run_queryFunction · 0.45
sample_dataFunction · 0.45
sample_dataFunction · 0.45

Calls 2

modelMethod · 0.95
saveMethod · 0.80