Skip to content

Commit 8fc5ab4

Browse files
committed
Ruff
1 parent d47b246 commit 8fc5ab4

File tree

5 files changed

+0
-236
lines changed

5 files changed

+0
-236
lines changed

src/models/bigquery_data_access_provider.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ def _read_gbq_dataframe(self, query: str) -> DataFrame:
4040
"""
4141
Execute a read query on Google BigQuery and return the results as a pandas DataFrame.
4242
Retries up to stop_after_attempt times on connection errors with exponential backoff.
43-
4443
Note:
4544
This method uses the bigframes.pandas.read_gbq function to execute the query. It relies on
4645
Application Default Credentials (ADC) for authentication, primarily using the
@@ -57,7 +56,6 @@ def _read_gbq_dataframe(self, query: str) -> DataFrame:
5756
logger.info("Using enviroment variable $GOOGLE_APPLICATION_CREDENTIALS for authentication.")
5857
else:
5958
logger.warning("GOOGLE_APPLICATION_CREDENTIALS not set, falling back to gcloud CLI user credentials")
60-
6159
# Execute the query with retry logic
6260
return cast(DataFrame, bpd.read_gbq(query).to_pandas())
6361

@@ -71,19 +69,15 @@ def _get_indexer_eligibility_query(self, start_date: date, end_date: date) -> st
7169
- Response latency <5,000ms,
7270
- Blocks behind <50,000,
7371
- Subgraph has >=500 GRT signal at query time
74-
7572
Note: The 500 GRT curation signal requirement is not currently implemented.
76-
7773
Args:
7874
start_date (date): The start date for the data range.
7975
end_date (date): The end date for the data range.
80-
8176
Returns:
8277
str: SQL query string for indexer eligibility data.
8378
"""
8479
start_date_str = start_date.strftime("%Y-%m-%d")
8580
end_date_str = end_date.strftime("%Y-%m-%d")
86-
8781
return f"""
8882
WITH
8983
-- Get daily query metrics per indexer
@@ -107,7 +101,6 @@ def _get_indexer_eligibility_query(self, start_date: date, end_date: date) -> st
107101
GROUP BY
108102
day_partition, indexer
109103
),
110-
111104
-- Determine which days count as 'online' (>= 1 good query on >= 10 subgraphs)
112105
DaysOnline AS (
113106
SELECT
@@ -120,7 +113,6 @@ def _get_indexer_eligibility_query(self, start_date: date, end_date: date) -> st
120113
FROM
121114
DailyMetrics
122115
),
123-
124116
-- Calculate unique subgraphs served with at least one good query
125117
UniqueSubgraphs AS (
126118
SELECT
@@ -136,7 +128,6 @@ def _get_indexer_eligibility_query(self, start_date: date, end_date: date) -> st
136128
GROUP BY
137129
indexer
138130
),
139-
140131
-- Calculate overall metrics per indexer
141132
IndexerMetrics AS (
142133
SELECT
@@ -154,7 +145,6 @@ def _get_indexer_eligibility_query(self, start_date: date, end_date: date) -> st
154145
GROUP BY
155146
d.indexer, ds.unique_good_response_subgraphs
156147
)
157-
158148
-- Final result with eligibility determination
159149
SELECT
160150
indexer,
@@ -176,15 +166,12 @@ def fetch_indexer_issuance_eligibility_data(self, start_date: date, end_date: da
176166
"""
177167
Fetch data from Google BigQuery, used to determine indexer issuance eligibility, and compute
178168
each indexer's issuance eligibility status.
179-
180169
Depends on:
181170
- _get_indexer_eligibility_query()
182171
- _read_gbq_dataframe()
183-
184172
Args:
185173
start_date (date): The start date for the data to fetch from BigQuery.
186174
end_date (date): The end date for the data to fetch from BigQuery.
187-
188175
Returns:
189176
DataFrame: DataFrame containing a range of metrics for each indexer.
190177
The DataFrame contains the following columns:
@@ -197,6 +184,5 @@ def fetch_indexer_issuance_eligibility_data(self, start_date: date, end_date: da
197184
"""
198185
# Construct the query
199186
query = self._get_indexer_eligibility_query(start_date, end_date)
200-
201187
# Return the results df
202188
return self._read_gbq_dataframe(query)

0 commit comments

Comments
 (0)