Function count Function count Aggregate queries often need to calculate the quantity of something. Here is how we get the number of students in Group 101: count ( s for s ...
Defining entities Defining entities Now, let’s create two entities – Person and Car. The entity Person has two attributes – name and age, and Car has attributes make and model. ...
Nominal subtyping Traits: nominal subtyping Structural subtyping Interfaces: structural subtyping Like other object-oriented languages, Pony has subtyping . That is, some type...
Queries and functions Queries and functions Below is the list of upper level functions defined in Pony: avg(gen, distinct=None) Return the average value for all selected attri...
Updating an object Updating an object >>> mary . age += 1 >>> commit () Pony keeps track of all changed attributes. When the commit() function is executed, all objec...
Queries Queries Pony provides a very convenient way to query the database using the generator expression syntax. Pony allows programmers to work with objects which are stored in...
Using raw SQL Using the raw_sql() function Using the select_by_sql() and get_by_sql() methods Using raw SQL Pony allows using raw SQL in your queries. There are two options on...
Using date and time in queries Using date and time in queries You can perform arithmetic operations with the datetime and timedelta in queries. If the expression can be calcu...