cubicweb logo

Table Of Contents

Previous topic

3.2. RQL syntax

Next topic

3.4. Implementation

This Page

3.3. Debugging RQL

3.3.1. Available levels

DBG_NONE:no debug information (current mode)
DBG_RQL:rql execution information
DBG_SQL:executed sql
DBG_REPO:repository events
DBG_MS:multi-sources
DBG_MORE:more verbosity
DBG_ALL:all level enabled

3.3.2. Enable verbose output

It may be interested to enable a verboser output to debug your RQL statements:

from cubicweb import server
server.set_debug(server.DBG_RQL|server.DBG_SQL|server.DBG_ALL)

3.3.3. Detect largest RQL queries

See Profiling and performance chapter (see Profiling and performance).

3.3.4. API

cubicweb.server.set_debug(debugmode)
change the repository debugging mode
class cubicweb.server.debugged(debugmode)

repository debugging context manager / decorator

Can be used either as a context manager:

>>> with debugged(server.DBG_RQL | server.DBG_REPO):
...     # some code in which you want to debug repository activity,
...     # seing information about RQL being executed an repository events.

or as a function decorator:

>>> @debugged(server.DBG_RQL | server.DBG_REPO)
... def some_function():
...     # some code in which you want to debug repository activity,
...     # seing information about RQL being executed an repository events

debug mode will be reseted at its original value when leaving the “with” block or the decorated function