diff --git a/queries/q4.sql b/queries/q4.sql new file mode 100644 index 000000000000..10d045ed6529 --- /dev/null +++ b/queries/q4.sql @@ -0,0 +1,2 @@ +explain analyze select * from work where id%5 = 1; + diff --git a/run_sql_test.py b/run_sql_test.py new file mode 100644 index 000000000000..0ced38920175 --- /dev/null +++ b/run_sql_test.py @@ -0,0 +1,22 @@ +import duckdb +import json + +duckdb_file = "db.duckdb" +duckdb_query = "queries/q1.sql" + +con = duckdb.connect(duckdb_file) +with open(duckdb_query, "r") as sql_file: + sql_query = sql_file.read() + +con.sql("PRAGMA enable_profiling='json'") +# print(sql_query) +res = con.sql(sql_query).to_df() +print(res['explain_value'][0]) +res = (res['explain_value'][0]) + +res = json.loads(res) +total_time = res["timing"] +# seq_time = res["children"] +print(f"Total Time: {total_time}") + +con.close()