Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option sqlite_debug_show_queries to print queries sent to SQLite #123

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

noahisaksen
Copy link

Implements issue#122

Name Description Default
sqlite_debug_show_queries DEBUG SETTING: print all queries sent to SQLite to stdout false

Implemented like the postgres_scanner and mysql_scanner this PR adds the setting, sqlite_debug_show_queries which prints the queries sent to sqlite to stdout using the helper Printer.

I don't believe we are able to test the stdout output in the sqllogictests, so I made sure to at least have a test that shows that enabling this setting, does not break regular queries.

Sample output.

D load 'build/release/extension/sqlite_scanner/sqlite_scanner.duckdb_extension';
D SET sqlite_debug_show_queries=true;
D ATTACH 'data/db/sakila.db' AS sakila;
D SELECT * FROM sakila.store limit 1;
BEGIN TRANSACTION

SELECT type FROM sqlite_master WHERE lower(name)=lower('store');

PRAGMA table_info('store')

SELECT MIN(ROWID), MAX(ROWID) FROM "store"

COMMIT

BEGIN TRANSACTION

SELECT type FROM sqlite_master WHERE lower(name)=lower('store');

PRAGMA table_info('store')

SELECT MIN(ROWID), MAX(ROWID) FROM "store"

SELECT "store_id", "manager_staff_id", "address_id", "last_update" FROM "store" WHERE ROWID BETWEEN 0 AND 2

COMMIT
┌──────────┬──────────────────┬────────────┬─────────────────────┐
│ store_id │ manager_staff_id │ address_id │     last_update     │
│  int64   │      int64       │   int64    │      timestamp      │
├──────────┼──────────────────┼────────────┼─────────────────────┤
│        1 │                1 │          1 │ 2021-03-06 15:52:00 │
└──────────┴──────────────────┴────────────┴─────────────────────┘

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant