Using the debug mode Using the debug mode Using the set_sql_debug() function, you can see the SQL commands that Pony sends to the database. In order to turn the debug mode on,...
Transactions and db_session Transactions and db_session A database transaction is a logical unit of work, which can consist of one or several queries. Transactions are atomic, w...
Attribute data types Attribute data types Pony supports the following attribute types: str unicode int float Decimal datetime date time timedelta bool buff...
Creating entity instances Creating entity instances Now, let’s create five objects that describe three persons and two cars, and save this information in the database: >>> p1 ...
Several aggregate functions in one query Several aggregate functions in one query SQL allows you including several aggregate functions in the same query. For example, we might w...
Async and db_session Async and db_session Pony was not developed for async usage, and it may be tricky to use it correctly in an async environment. However, if only part of your...
What can you use a primitive for? Built-in primitive types Primitive initialisation and finalisation A primitive is similar to a class , but there are two critical difference...
Modifying JSON attribute Modifying JSON attribute For modifying the JSON attribute value, you use the standard Python list and dict API as well: >>> Product [ 1 ]. info [ 'co...
More sophisticated aggregate queries More sophisticated aggregate queries Using Pony you can do even more complex grouping. For example, you can group by an attribute part: sel...