doc/book/en/development/devcore/dbapi.rst
author Nicolas Chauvat <nicolas.chauvat@logilab.fr>
Sun, 08 Nov 2009 19:34:31 +0100
branchstable
changeset 3806 6a4191b0eb9a
parent 2175 16d3c37c5d28
child 4441 550cf406dbc6
permissions -rw-r--r--
[web ui] remove "trame_grise" from forms



API Python/RQL
~~~~~~~~~~~~~~

The Python API developped to interface with RQL is inspired from the standard db-api,
with a Connection object having the methods cursor, rollback and commit essentially.
The most important method is the `execute` method of a cursor :

`execute(rqlstring, args=None, eid_key=None, build_descr=True)`

:rqlstring: the RQL query to execute (unicode)
:args: if the query contains substitutions, a dictionary containing the values to use
:eid_key:
   an implementation detail of the RQL cache implies that if a substitution
   is used to introduce an eid *susceptible to raise the ambiguities in the query
   type resolution*, then we have to specify the corresponding key in the dictionary
   through this argument


The `Connection` object owns the methods `commit` and `rollback`. You *should
never need to use them* during the development of the web interface based on
the *CubicWeb* framework as it determines the end of the transaction depending
on the query execution success.

.. note::
  While executing update queries (SET, INSERT, DELETE), if a query generates
  an error related to security, a rollback is automatically done on the current
  transaction.