Community mailing list archives

Re: Odoo 8 computed field issue

OpusVL, Nick Booker
- 11/20/2015 09:38:02
Hi Yassine.

Yassine Teimi <> writes:

> On the other hand, do you have an idea what kind of return does :
>'sql suery') ?

It returns nothing useful.

Do cr.fetchall() to get a list of tuples containing the results.

There's also cr.fetchone() and cr.fetchmany().

See also:

> And how to use sql query parameters ? explicitly, how to use variables
> on the sql query ?

    'SELECT x, y, z FROM table WHERE name = %s AND state = %s',
    (myname, mystate)

for x, y, z in cr.fetchall():
    # do something with x, y and z