feat: Add BigQuery ObjectRef functions to bigframes.bigquery.obj#2380
feat: Add BigQuery ObjectRef functions to bigframes.bigquery.obj#2380
bigframes.bigquery.obj#2380Conversation
This change introduces support for BigQuery ObjectRef functions: - `OBJ.FETCH_METADATA` - `OBJ.GET_ACCESS_URL` - `OBJ.MAKE_REF` These are exposed via a new `bigframes.bigquery.obj` module.
jialuoo
left a comment
There was a problem hiding this comment.
Are these test failures related to this PR? I’ve also added Trevor as a reviewer since he probably have more context on the background of these changes than I do.
|
|
||
| """ | ||
| ObjectRef functions defined from | ||
| https://cloud.google.com/bigquery/docs/reference/standard-sql/object-ref-functions |
There was a problem hiding this comment.
bigframes/bigquery/obj.py
Outdated
| # limitations under the License. | ||
|
|
||
| """This module exposes `BigQuery ObjectRef | ||
| <https://cloud.google.com/bigquery/docs/object-table-object-ref-functions>`_ functions. |
| SELECT | ||
| *, | ||
| OBJ.GET_ACCESS_URL(`bfcol_4`) AS `bfcol_7` | ||
| OBJ.GET_ACCESS_URL(`bfcol_4`, 'R') AS `bfcol_7` |
There was a problem hiding this comment.
We may still need minimum system tests. Otherwise we may fail to catch errors like this. WDYT?
|
|
||
| @log_adapter.method_logger(custom_base_name="bigquery_obj") | ||
| def make_ref( | ||
| uri_or_json: series.Series, |
There was a problem hiding this comment.
It can also be a single value in SQL. E.g. OBJ.MAKE_REF("gs://something", "us.my_connection"). It can be useful in local experiments. Do we want to support the case?
There was a problem hiding this comment.
Great it can accept list like input now. I meant it can also be a single string value. E.g. OBJ.MAKE_REF("gs://something", "us.my_connection").
There was a problem hiding this comment.
Since I still want to return a Series, this would be a bit confusing. Alternatively, if we get a scalar, we could immediately execute and return a scalar, but I'd like to keep these APIs with as little client-side logic as we can do.
| def fetch_metadata( | ||
| objectref: series.Series, | ||
| ) -> series.Series: | ||
| """The OBJ.FETCH_METADATA function returns Cloud Storage metadata for a partially populated ObjectRef value. |
There was a problem hiding this comment.
Should add the preview disclaimer.
PR created by the Librarian CLI to initialize a release. Merging this PR will auto trigger a release. Librarian Version: v0.7.0 Language Image: us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:e7cc6823efb073a8a26e7cefdd869f12ec228abfbd2a44aa9a7eacc284023677 <details><summary>bigframes: 2.33.0</summary> ## [2.33.0](v2.32.0...v2.33.0) (2026-01-22) ### Features * add bigquery.ml.transform function (#2394) ([1f9ee37](1f9ee373)) * Add dark mode to anywidget mode (#2365) ([2763b41](2763b41d)) * Add max_columns control for anywidget mode (#2374) ([34b5975](34b5975f)) * Configure Biome for Consistent Code Style (#2364) ([81e27b3](81e27b3d)) * Add BigQuery ObjectRef functions to `bigframes.bigquery.obj` (#2380) ([9c3bbc3](9c3bbc36)) * Stabilize interactive table height to prevent notebook layout shifts (#2378) ([a634e97](a634e976)) ### Bug Fixes * implement retry logic for cloud function endpoint fetching (#2369) ([0f593c2](0f593c27)) * Throw if write api commit op has stream_errors (#2385) ([7abfef0](7abfef05)) ### Performance Improvements * Avoid requery for some result downsample methods (#2219) ([95763ff](95763ff2)) </details>
This change introduces support for BigQuery ObjectRef functions:
OBJ.FETCH_METADATAOBJ.GET_ACCESS_URLOBJ.MAKE_REFThese are exposed via a new
bigframes.bigquery.objmodule.Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Replaces #2340
🦕