liferoad commented on code in PR #34135:
URL: https://github.com/apache/beam/pull/34135#discussion_r1976626293


##########
sdks/python/apache_beam/io/gcp/bigquery_tools.py:
##########
@@ -786,11 +788,58 @@ def get_table(self, project_id, dataset_id, table_id):
     Raises:
       HttpError: if lookup failed.
     """
+    cache_key = f"{project_id}:{dataset_id}.{table_id}"
+    if cache_key in self._table_cache:
+      _LOGGER.debug("Cache hit for table: %s", cache_key)
+      return self._table_cache[cache_key]
+
+    _LOGGER.debug("Cache miss for table: %s", cache_key)
     request = bigquery.BigqueryTablesGetRequest(
         projectId=project_id, datasetId=dataset_id, tableId=table_id)
     response = self.client.tables.Get(request)
+    
+    # Store the response in cache
+    self._table_cache[cache_key] = response
     return response
 
+  def clear_table_cache(self, project_id=None, dataset_id=None, table_id=None):
+    """Clear the cache for tables.

Review Comment:
   when is this called to clear the cache?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to