Created
August 17, 2022 08:34
-
-
Save Bouncner/1a4e814289341ca2f7c3edf7436655a8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python3 | |
| import datetime | |
| import os | |
| import psycopg2 | |
| import sys | |
| import time | |
| connection = psycopg2.connect("host=rapa.eaalab.hpi.uni-potsdam.de port=5432") | |
| connection.autocommit = True | |
| cursor = connection.cursor() | |
| while True: | |
| print("Starting to run all queries of input file.") | |
| with open("Generated-TPCH-SQL-30.csv") as query_file: | |
| for query_id, query in enumerate(query_file): | |
| start_time = time.time() | |
| print(f" {datetime.datetime.now()}: Starting query #{query_id}", end="") | |
| cursor.execute(query.strip()) | |
| result = cursor.fetchall() | |
| print(f" ... done ({time.time() - start_time:.2f} s; {len(result)} rows).") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment