Skip to content

Commit b4bcf87

Browse files
committed
lint
1 parent 7564a82 commit b4bcf87

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

download_analytics/bq.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import logging
77
import os
88
import pathlib
9-
import pandas as pd
109

1110
from google.cloud import bigquery
1211
from google.oauth2 import service_account
@@ -51,7 +50,8 @@ def run_query(query, dry_run=False, credentials_file=None):
5150

5251
job_config = bigquery.QueryJobConfig(dry_run=True, use_query_cache=False)
5352
dry_run_job = client.query(query, job_config=job_config)
54-
LOGGER.info('Estimated data processed in query (GBs): %.2f', dry_run_job.total_bytes_processed / 1024**3)
53+
data_processed_gbs = dry_run_job.total_bytes_processed / 1024**3
54+
LOGGER.info('Estimated data processed in query (GBs): %.2f', data_processed_gbs)
5555
# https://cloud.google.com/bigquery/pricing#on_demand_pricing
5656
# assuming have hit 1 terabyte processed in month
5757
cost_per_terabyte = 6.15
@@ -70,11 +70,17 @@ def run_query(query, dry_run=False, credentials_file=None):
7070
LOGGER.info('Total cost for query: $%.2f', cost)
7171
return data
7272

73+
7374
def bytes_to_megabytes(bytes):
75+
"""Convert bytes to megabytes."""
7476
return bytes / 1024 / 1024
7577

78+
7679
def bytes_to_gigabytes(bytes):
80+
"""Convert bytes to gigabytes."""
7781
return bytes_to_megabytes(bytes) / 1024
7882

83+
7984
def bytes_to_terabytes(bytes):
85+
"""Convert bytes to terabytes."""
8086
return bytes_to_gigabytes(bytes) / 1024

0 commit comments

Comments
 (0)