File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 2828
2929# Configuration
3030CONN_STR = os .getenv ("DB_CONNECTION_STRING" )
31+
32+ # Ensure pyodbc connection string has ODBC driver specified
33+ if CONN_STR and 'Driver=' not in CONN_STR :
34+ CONN_STR = f"Driver={{ODBC Driver 18 for SQL Server}};{ CONN_STR } "
35+
3136NUM_ITERATIONS = 5 # Number of times to run each test for averaging
3237
3338# SQL Queries
@@ -284,11 +289,11 @@ def main():
284289 print (f"\n Running: { name } " )
285290 print (f" Testing with pyodbc... " , end = "" , flush = True )
286291 pyodbc_result = run_benchmark_pyodbc (query , name , NUM_ITERATIONS )
287- print (f"✓ (avg: { pyodbc_result .avg_time :.4f} s)" )
292+ print (f"OK (avg: { pyodbc_result .avg_time :.4f} s)" )
288293
289294 print (f" Testing with mssql-python... " , end = "" , flush = True )
290295 mssql_python_result = run_benchmark_mssql_python (query , name , NUM_ITERATIONS )
291- print (f"✓ (avg: { mssql_python_result .avg_time :.4f} s)" )
296+ print (f"OK (avg: { mssql_python_result .avg_time :.4f} s)" )
292297
293298 all_results .append ((pyodbc_result , mssql_python_result ))
294299
Original file line number Diff line number Diff line change @@ -590,6 +590,19 @@ jobs:
590590 -e DB_CONNECTION_STRING="Server=$SQLSERVER_IP;Database=AdventureWorks2022;Uid=SA;Pwd=$(DB_PASSWORD);TrustServerCertificate=yes" \
591591 test-container-$(distroName) bash -c "
592592 source /opt/venv/bin/activate
593+
594+ echo 'Reinstalling ODBC Driver for benchmarking...'
595+ export DEBIAN_FRONTEND=noninteractive
596+
597+ # Add Microsoft repository
598+ curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
599+ curl https://packages.microsoft.com/config/ubuntu/22.04/prod.list | tee /etc/apt/sources.list.d/mssql-release.list
600+ apt-get update
601+
602+ # Install ODBC Driver 18
603+ ACCEPT_EULA=Y apt-get install -y msodbcsql18
604+ apt-get install -y unixodbc-dev
605+
593606 echo 'Installing pyodbc for benchmarking...'
594607 pip install pyodbc
595608 echo 'Running performance benchmarks on $(distroName)'
You can’t perform that action at this time.
0 commit comments