Skip to content

Commit bd54084

Browse files
feat: Add BigQuery ObjectRef functions to bigframes.bigquery.obj
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. Changes: - Added `ObjMakeRefJson` operation in `bigframes/operations/blob_ops.py`. - Updated `ObjGetAccessUrl` operation to support optional duration. - Updated `bigframes/operations/__init__.py` to export new operations. - Updated `bigframes/core/compile/ibis_compiler/scalar_op_registry.py` and `bigframes/core/compile/sqlglot/expressions/blob_ops.py` to support new operations. - Created `bigframes/bigquery/_operations/obj.py` with the implementation of `fetch_metadata`, `get_access_url`, and `make_ref`. - Created `bigframes/bigquery/obj.py` to expose the functions. - Exposed `obj` module in `bigframes/bigquery/__init__.py`. - Added unit tests in `tests/unit/bigquery/test_obj.py`. - Updated `tests/unit/core/compile/sqlglot/expressions/test_blob_ops.py` snapshots. - Fixed type checking and linting errors.
1 parent 4ade806 commit bd54084

File tree

2 files changed

+4
-2
lines changed
  • tests/unit
    • bigquery
    • core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_get_access_url

2 files changed

+4
-2
lines changed

tests/unit/bigquery/test_obj.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@
1313
# limitations under the License.
1414

1515
import datetime
16+
from unittest.mock import MagicMock
17+
1618
import pytest
17-
from unittest.mock import MagicMock, patch
1819

1920
import bigframes.bigquery.obj as obj
2021
import bigframes.operations as ops
2122
import bigframes.series as series
2223

24+
2325
def test_fetch_metadata_op_structure():
2426
op = ops.obj_fetch_metadata_op
2527
assert op.name == "obj_fetch_metadata"

tests/unit/core/compile/sqlglot/expressions/snapshots/test_blob_ops/test_obj_get_access_url/out.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ WITH `bfcte_0` AS (
1111
), `bfcte_2` AS (
1212
SELECT
1313
*,
14-
OBJ.GET_ACCESS_URL(`bfcol_4`) AS `bfcol_7`
14+
OBJ.GET_ACCESS_URL(`bfcol_4`, 'R') AS `bfcol_7`
1515
FROM `bfcte_1`
1616
), `bfcte_3` AS (
1717
SELECT

0 commit comments

Comments
 (0)