@@ -42,7 +42,6 @@ def _convert_information_schema_table_id_to_table_reference(
4242 default_project : Optional [str ],
4343) -> bigquery .TableReference :
4444 """Squeeze an INFORMATION_SCHEMA reference into a TableReference.
45-
4645 This is kind-of a hack. INFORMATION_SCHEMA is a view that isn't available
4746 via the tables.get REST API.
4847 """
@@ -152,13 +151,7 @@ def get_table_metadata(
152151
153152 return cached_table
154153
155- table_id_casefold = table_id .casefold ()
156- if (
157- # Ensure we don't have false positives for some user defined dataset
158- # like MY_INFORMATION_SCHEMA or tables called INFORMATION_SCHEMA.
159- ".INFORMATION_SCHEMA." .casefold () in table_id_casefold
160- or table_id_casefold .startswith ("INFORMATION_SCHEMA." .casefold ())
161- ):
154+ if is_information_schema (table_id ):
162155 table = get_information_schema_metadata (
163156 bqclient = bqclient , table_id = table_id , default_project = default_project
164157 )
@@ -179,6 +172,17 @@ def get_table_metadata(
179172 return cached_table
180173
181174
175+ def is_information_schema (table_id : str ):
176+ table_id_casefold = table_id .casefold ()
177+ # Include the "."s to ensure we don't have false positives for some user
178+ # defined dataset like MY_INFORMATION_SCHEMA or tables called
179+ # INFORMATION_SCHEMA.
180+ return (
181+ ".INFORMATION_SCHEMA." .casefold () in table_id_casefold
182+ or table_id_casefold .startswith ("INFORMATION_SCHEMA." .casefold ())
183+ )
184+
185+
182186def is_time_travel_eligible (
183187 bqclient : bigquery .Client ,
184188 table : google .cloud .bigquery .table .Table ,
@@ -245,6 +249,8 @@ def is_time_travel_eligible(
245249 msg , category = bfe .TimeTravelDisabledWarning , stacklevel = stacklevel
246250 )
247251 return False
252+ elif table .table_type == "VIEW" :
253+ return False
248254
249255 # table might support time travel, lets do a dry-run query with time travel
250256 if should_dry_run :
0 commit comments