Skip to content

Commit 1ad61f1

Browse files
Aniket Mokashianiket486
authored andcommitted
Minor edits to python script and Readme
1 parent 1a92778 commit 1ad61f1

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

bigquery/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Download Google Cloud CLI and configure your project settings:
1+
Download Google Cloud CLI and configure your project settings. You can skip this step if you are using [Cloud shell](https://docs.cloud.google.com/shell/docs/launching-cloud-shell):
22
```
33
wget --continue --progress=dot:giga https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-linux-x86_64.tar.gz
44
tar -xf google-cloud-cli-linux-x86_64.tar.gz

bigquery/run_queries.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import sys
55
from typing import TextIO, Any
6+
from datetime import datetime
67

78
def log(*objects: Any, sep: str = ' ', end: str = '\n', file: TextIO = sys.stderr, severity: str = 'INFO') -> None:
89
"""
@@ -50,14 +51,18 @@ def log(*objects: Any, sep: str = ' ', end: str = '\n', file: TextIO = sys.stder
5051
for i in range(TRIES):
5152
log(f"\n[{i}]: {query}")
5253
try:
54+
client_start_time = datetime.now()
5355
query_job = client.query(query, job_config=job_config)
5456
results = query_job.result()
57+
client_end_time = datetime.now()
58+
5559
execution_time = query_job.ended - query_job.started
5660
total_time = query_job.ended - query_job.created
5761
total_time_secs = total_time.total_seconds()
5862
endstr = "],\n" if i == 2 else ","
5963
print(f"{total_time_secs}", end=endstr)
6064

65+
client_time = client_end_time - client_start_time
6166
log(f"Job ID: **{query_job.job_id}**")
6267
log(f"Query ID: **{query_job.query_id}**")
6368
log(f"State: **{query_job.state}**")
@@ -67,6 +72,7 @@ def log(*objects: Any, sep: str = ' ', end: str = '\n', file: TextIO = sys.stder
6772
log(f"End Time: {query_job.ended}")
6873
log(f"Execution Time: {execution_time}")
6974
log(f"Total Time: {total_time}")
75+
log(f"Client Time: {client_time}")
7076
log(f"Total Rows Returned: {results.total_rows}")
7177

7278
except Exception as e:

0 commit comments

Comments
 (0)