Jam.py documentation

execute

execute(self, sql)

domain: server

language: python

class Task class

Description

Use execute to execute an SQL query (except SELECT queries) using multiprocessing connection pool. For SELECT queries use the select method.

The sql parameter can be a query string, a list of query strings, a list of lists and so on.

All queries are executed in one transaction and if execution succeeds the COMMIT command is called, otherwise ROLLBACK command is executed.

Example

sql = []
for i in ids:
    sql.append('UPDATE DEMO_CUSTOMERS SET QUANTITY=2 WHERE ID=%s' % i)
item.task.execute(sql)

See also

select