Strikerrx01 commented on code in PR #34135:
URL: https://github.com/apache/beam/pull/34135#discussion_r1979488502
##########
sdks/python/apache_beam/io/gcp/bigquery_tools.py:
##########
@@ -474,9 +495,61 @@ def get_query_location(self, project_id, query,
use_legacy_sql):
query)
return None
+ def get_table(self, project_id, dataset_id, table_id):
+ """Lookup a table's metadata object.
+
+ Args:
+ project_id: table lookup parameter
+ dataset_id: table lookup parameter
+ table_id: table lookup parameter
+
+ Returns:
+ bigquery.Table instance
+ Raises:
+ HttpError: if lookup failed.
+ """
+ # Skip caching if TTL is set to 0
+ if self._table_definition_ttl <= 0:
Review Comment:
@stankiewicz You're right - the current check `if self._table_definition_ttl
<= 0:` would incorrectly allow negative TTL values. I'll fix this by:
1. Changing the check to explicitly handle 0 case: if
self.table_definition_ttl == 0: # Only disable caching when TTL is exactly 0
2. Ensuring negative values are rejected in `set_table_definition_ttl()`: if
ttl_seconds < 0:
raise ValueError("TTL cannot be negative")
This way we properly handle:
- TTL = 0: Disable caching
- TTL > 0: Enable caching with specified TTL
- TTL < 0: Raise error
Would you like me to make this change?
--
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]