mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-28 04:44:26 +02:00
Tracer example using print, refs #150
This commit is contained in:
parent
e6d202b742
commit
32f1badfec
1 changed files with 2 additions and 2 deletions
|
|
@ -67,10 +67,10 @@ You can also turn on a tracer function temporarily for a block of code using the
|
||||||
|
|
||||||
db = Database(memory=True)
|
db = Database(memory=True)
|
||||||
# ... later
|
# ... later
|
||||||
with db.tracer(tracer):
|
with db.tracer(print):
|
||||||
db["dogs"].insert({"name": "Cleo"})
|
db["dogs"].insert({"name": "Cleo"})
|
||||||
|
|
||||||
Queries will be passed to your ``tracer()`` function only for the duration of the ``with`` block.
|
This example will print queries only for the duration of the ``with`` block.
|
||||||
|
|
||||||
.. _python_api_execute:
|
.. _python_api_execute:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue