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

Function run_query

docs_src/queries/docs002.py:35–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33
34@create_drop_database(base_config=ormar_base_config)
35async def run_query():
36 await Book.objects.create(
37 title="Tom Sawyer", author="Twain, Mark", genre="Adventure"
38 )
39 await Book.objects.create(
40 title="War and Peace", author="Tolstoy, Leo", genre="Fiction"
41 )
42 await Book.objects.create(
43 title="Anna Karenina", author="Tolstoy, Leo", genre="Fiction"
44 )
45
46 await Book.objects.update(each=True, genre="Fiction")
47 all_books = await Book.objects.filter(genre="Fiction").all()
48 assert len(all_books) == 3
49
50
51asyncio.run(run_query())

Callers 1

docs002.pyFile · 0.70

Calls 4

createMethod · 0.45
updateMethod · 0.45
allMethod · 0.45
filterMethod · 0.45

Tested by

no test coverage detected