- Python Brasil 2022 - Queries performáticas com ORM em Python, Django e Postgres.pdf
- 2nd option: slideshare
Make sure you have poetry installed, then run:
poetry install
poetry run python manage.py migrate
poetry run python manage.py create_test_records
See available params with:
poetry run python manage.py create_test_records --help
In file shop/samples.py
, we can find several good/bad examples of ORM queries.
To run those queries, do:
$ poetry run python manage.py shell_plus
Then, in the python shell, run:
# Using a "bad" example - this will run several unucessary queries
from shop.samples import list_orders_bad
list_orders_bad()
Another example:
# Using a "good" example - this is optimized
from shop.samples import list_orders_good
list_orders_good()