Tracer mechanism for showing underlying SQL queries

* Pass a tracer= function to Database constructor
* New db.tracer() contextmanager
* Neater SQL indentation, because tracer means it could be visible now
* New db.execute() and db.executescript() methods

Closes #150
This commit is contained in:
Simon Willison 2020-09-07 14:56:59 -07:00 committed by GitHub
commit cf2cb244fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 231 additions and 79 deletions

View file

@ -73,7 +73,7 @@ def test_table_repr(fresh_db):
def test_indexes(fresh_db):
fresh_db.conn.executescript(
fresh_db.executescript(
"""
create table Gosh (c1 text, c2 text, c3 text);
create index Gosh_c1 on Gosh(c1);