April 2019
Beginner to intermediate
774 pages
24h 59m
English
In step 2, we declare an SQL SELECT query. This will return the average number of days a user holds a particular book. If you run this query in the PostgreSQL CLI, you will get a result based on your book data:
+---------------------------------------+-------+| name | avg ||---------------------------------------+-------|| Odoo 12 Development Cookbook | 33 || PostgreSQL 10 Administration Cookbook | 81 |+---------------------------------------+-------+
Step 3 calls the execute() method on the database cursor stored in self.env.cr. This sends the query to PostgreSQL and executes it.
Step 5 uses the fetchall() method of the cursor to retrieve a list of rows selected by the query. This method returns a list of rows. In my case, ...
Read now
Unlock full access