Skip to content

Commit 97ee94a

Browse files
mrishicopybara-github
authored andcommitted
Copybara import of the project:
-- ca696fb by mrishi <rishisapps@gmail.com>: fix(feature_store): safely parse bq:// URIs using removeprefix The previous implementation used `.lstrip("bq://")`, which greedily dropped valid characters (like 'b' or 'q') from the beginning of Google Cloud Project IDs. Replaced `lstrip` with `removeprefix` to explicitly remove only the protocol string without mutating the project ID. -- 804ce2f by mrishi <rishisapps@gmail.com>: fix(offline_store): safely parse bq:// URIs using removeprefix -- 9bb798f by mrishi <rishisapps@gmail.com>: fix(offline_store): safely parse bq:// URIs using removeprefix -- f7e9447 by mrishi <rishisapps@gmail.com>: fix(aiplatform): safely parse bq:// URIs using removeprefix -- 8f7aa97 by mrishi <rishisapps@gmail.com>: fix(ai_platform): Black check COPYBARA_INTEGRATE_REVIEW=#6771 from mrishi:fix-bq-uri-parsing c922bbb PiperOrigin-RevId: 936106848
1 parent d5bd31c commit 97ee94a

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

agentplatform/resources/preview/feature_store/offline_store.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def _feature_to_data_source(
116116
bq_uri = feature_group._gca_resource.big_query.big_query_source.input_uri
117117
assert bq_uri
118118

119-
fully_qualified_table = bq_uri.lstrip("bq://")
119+
fully_qualified_table = bq_uri.removeprefix("bq://")
120120
assert fully_qualified_table
121121

122122
query = (

google/cloud/aiplatform/preview/datasets.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
from google.protobuf import struct_pb2
4040
from google.protobuf import json_format
4141

42-
4342
_MULTIMODAL_METADATA_SCHEMA_URI = (
4443
"gs://google-cloud-aiplatform/schema/dataset/metadata/multimodal_1.0.0.yaml"
4544
)
@@ -1122,7 +1121,9 @@ def to_bigframes(self) -> "bigframes.pandas.DataFrame": # type: ignore # noqa:
11221121
A BigFrames dataframe.
11231122
"""
11241123
bigframes = _try_import_bigframes()
1125-
return bigframes.pandas.read_gbq_table(self.bigquery_table.lstrip("bq://"))
1124+
return bigframes.pandas.read_gbq_table(
1125+
self.bigquery_table.removeprefix("bq://")
1126+
)
11261127

11271128
@classmethod
11281129
@base.optional_sync()
@@ -1409,7 +1410,7 @@ def assemble(
14091410
)
14101411
result = assemble_lro.result(timeout=None)
14111412
_LOGGER.log_action_completed_against_resource("data", "assembled", self)
1412-
table_id = result.bigquery_destination.lstrip("bq://")
1413+
table_id = result.bigquery_destination.removeprefix("bq://")
14131414
if load_dataframe:
14141415
session_options = bigframes.BigQueryOptions(
14151416
credentials=initializer.global_config.credentials,

vertexai/resources/preview/feature_store/offline_store.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ def _feature_to_data_source(
118118
bq_uri = feature_group._gca_resource.big_query.big_query_source.input_uri
119119
assert bq_uri
120120

121-
fully_qualified_table = bq_uri.lstrip("bq://")
121+
fully_qualified_table = bq_uri.removeprefix("bq://")
122+
122123
assert fully_qualified_table
123124

124125
query = (

0 commit comments

Comments
 (0)