Skip to content

Commit 44998e4

Browse files
authored
Merge branch 'main' into update-codeowners-bq-dataframes-4709133254732906551
2 parents 89a7d88 + 32d9f7e commit 44998e4

File tree

117 files changed

+40694
-6204
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+40694
-6204
lines changed

.github/CODEOWNERS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,13 @@
1212
* @googleapis/cloud-sdk-python-team @googleapis/cloud-sdk-librarian-team
1313

1414
/packages/bigframes/ @googleapis/cloud-sdk-python-team @googleapis/cloud-sdk-librarian-team @googleapis/bigquery-dataframe-team
15+
<<<<<<< update-codeowners-bq-dataframes-4709133254732906551
1516
/packages/bigquery-magics/ @googleapis/cloud-sdk-python-team @googleapis/cloud-sdk-librarian-team @googleapis/bigquery-dataframe-team
1617
/packages/google-cloud-bigquery*/ @googleapis/cloud-sdk-python-team @googleapis/cloud-sdk-librarian-team @googleapis/bigquery-dataframe-team
1718
/packages/pandas-gbq/ @googleapis/cloud-sdk-python-team @googleapis/cloud-sdk-librarian-team @googleapis/bigquery-dataframe-team
1819
/packages/sqlalchemy-bigquery/ @googleapis/cloud-sdk-python-team @googleapis/cloud-sdk-librarian-team @googleapis/bigquery-dataframe-team
20+
=======
21+
/packages/django-google-spanner/ @googleapis/cloud-sdk-python-team @googleapis/cloud-sdk-librarian-team @googleapis/spanner-team
22+
>>>>>>> main
1923
/packages/google-auth/ @googleapis/cloud-sdk-python-team @googleapis/cloud-sdk-librarian-team @googleapis/cloud-sdk-auth-team @googleapis/aion-team
24+
/packages/google-cloud-spanner/ @googleapis/cloud-sdk-python-team @googleapis/cloud-sdk-librarian-team @googleapis/spanner-team

.librarian/state.yaml

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# Copyright 2026 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
114
image: us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:234b9d1f2ddb057ed7ac6a38db0bf8163d839c65c6cf88ade52530cddebce59e
215
libraries:
316
- id: bigframes
@@ -164,7 +177,6 @@ libraries:
164177
last_generated_commit: 7a5706618f42f482acf583febcc7b977b66c25b2
165178
apis:
166179
- path: google/apps/card/v1
167-
service_config: ""
168180
source_roots:
169181
- packages/google-apps-card
170182
preserve_regex:
@@ -176,7 +188,7 @@ libraries:
176188
tag_format: '{id}-v{version}'
177189
- id: google-apps-chat
178190
version: 0.7.0
179-
last_generated_commit: 7a5706618f42f482acf583febcc7b977b66c25b2
191+
last_generated_commit: 2233f63baf69c2a481f30180045fcf036242781d
180192
apis:
181193
- path: google/chat/v1
182194
service_config: chat_v1.yaml
@@ -225,19 +237,12 @@ libraries:
225237
last_generated_commit: 3322511885371d2b2253f209ccc3aa60d4100cfd
226238
apis:
227239
- path: google/apps/script/type
228-
service_config: ""
229240
- path: google/apps/script/type/gmail
230-
service_config: ""
231241
- path: google/apps/script/type/docs
232-
service_config: ""
233242
- path: google/apps/script/type/drive
234-
service_config: ""
235243
- path: google/apps/script/type/sheets
236-
service_config: ""
237244
- path: google/apps/script/type/calendar
238-
service_config: ""
239245
- path: google/apps/script/type/slides
240-
service_config: ""
241246
source_roots:
242247
- packages/google-apps-script-type
243248
preserve_regex:
@@ -316,7 +321,6 @@ libraries:
316321
- path: google/identity/accesscontextmanager/v1
317322
service_config: accesscontextmanager_v1.yaml
318323
- path: google/identity/accesscontextmanager/type
319-
service_config: ""
320324
source_roots:
321325
- packages/google-cloud-access-context-manager
322326
preserve_regex: []
@@ -484,7 +488,6 @@ libraries:
484488
last_generated_commit: 3322511885371d2b2253f209ccc3aa60d4100cfd
485489
apis:
486490
- path: google/appengine/logging/v1
487-
service_config: ""
488491
source_roots:
489492
- packages/google-cloud-appengine-logging
490493
preserve_regex:
@@ -508,6 +511,24 @@ libraries:
508511
remove_regex:
509512
- packages/google-cloud-apphub/
510513
tag_format: '{id}-v{version}'
514+
- id: google-cloud-appoptimize
515+
version: 0.0.0
516+
last_generated_commit: cd090841ab172574e740c214c99df00aef9c0dee
517+
apis:
518+
- path: google/cloud/appoptimize/v1beta
519+
service_config: appoptimize_v1beta.yaml
520+
source_roots:
521+
- packages/google-cloud-appoptimize
522+
preserve_regex:
523+
- packages/google-cloud-appoptimize/CHANGELOG.md
524+
- docs/CHANGELOG.md
525+
- samples/README.txt
526+
- scripts/client-post-processing
527+
- samples/snippets/README.rst
528+
- tests/system
529+
remove_regex:
530+
- packages/google-cloud-appoptimize
531+
tag_format: '{id}-v{version}'
511532
- id: google-cloud-artifact-registry
512533
version: 1.21.0
513534
last_generated_commit: 6df3ecf4fd43b64826de6a477d1a535ec18b0d7c
@@ -869,7 +890,6 @@ libraries:
869890
last_generated_commit: 3322511885371d2b2253f209ccc3aa60d4100cfd
870891
apis:
871892
- path: google/cloud/bigquery/logging/v1
872-
service_config: ""
873893
source_roots:
874894
- packages/google-cloud-bigquery-logging
875895
preserve_regex:
@@ -1657,7 +1677,7 @@ libraries:
16571677
tag_format: '{id}-v{version}'
16581678
- id: google-cloud-dlp
16591679
version: 3.35.0
1660-
last_generated_commit: 59d5f2b46924714af627ac29ea6de78641a00835
1680+
last_generated_commit: 2233f63baf69c2a481f30180045fcf036242781d
16611681
apis:
16621682
- path: google/privacy/dlp/v2
16631683
service_config: dlp_v2.yaml
@@ -1890,7 +1910,6 @@ libraries:
18901910
- path: google/firestore/admin/v1
18911911
service_config: firestore_v1.yaml
18921912
- path: google/firestore/bundle
1893-
service_config: ""
18941913
- path: google/firestore/v1
18951914
service_config: firestore_v1.yaml
18961915
source_roots:
@@ -2130,7 +2149,6 @@ libraries:
21302149
last_generated_commit: 3322511885371d2b2253f209ccc3aa60d4100cfd
21312150
apis:
21322151
- path: google/iam/v1/logging
2133-
service_config: ""
21342152
source_roots:
21352153
- packages/google-cloud-iam-logging
21362154
preserve_regex:
@@ -2424,7 +2442,7 @@ libraries:
24242442
tag_format: '{id}-v{version}'
24252443
- id: google-cloud-memorystore
24262444
version: 0.4.0
2427-
last_generated_commit: 582172de2d9b6443e1fecf696167867c6d8a5fc4
2445+
last_generated_commit: 2233f63baf69c2a481f30180045fcf036242781d
24282446
apis:
24292447
- path: google/cloud/memorystore/v1beta
24302448
service_config: memorystore_v1beta.yaml
@@ -2672,7 +2690,6 @@ libraries:
26722690
last_generated_commit: 55319b058f8a0e46bbeeff30e374e4b1f081f494
26732691
apis:
26742692
- path: google/cloud/orgpolicy/v1
2675-
service_config: ""
26762693
- path: google/cloud/orgpolicy/v2
26772694
service_config: orgpolicy_v2.yaml
26782695
source_roots:
@@ -2851,7 +2868,7 @@ libraries:
28512868
tag_format: '{id}-v{version}'
28522869
- id: google-cloud-pubsub
28532870
version: 2.36.0
2854-
last_generated_commit: 256b575f6915282b20795c13414b21f2c0af65db
2871+
last_generated_commit: 2233f63baf69c2a481f30180045fcf036242781d
28552872
apis:
28562873
- path: google/pubsub/v1
28572874
service_config: pubsub_v1.yaml
@@ -3252,7 +3269,6 @@ libraries:
32523269
last_generated_commit: 3322511885371d2b2253f209ccc3aa60d4100cfd
32533270
apis:
32543271
- path: google/devtools/source/v1
3255-
service_config: ""
32563272
source_roots:
32573273
- packages/google-cloud-source-context
32583274
preserve_regex:
@@ -3367,7 +3383,7 @@ libraries:
33673383
tag_format: '{id}-v{version}'
33683384
- id: google-cloud-storage
33693385
version: 3.10.1
3370-
last_generated_commit: 280bed6c219637610d09cebf696958dd99fd2f76
3386+
last_generated_commit: 2233f63baf69c2a481f30180045fcf036242781d
33713387
apis:
33723388
- path: google/storage/v2
33733389
service_config: storage_v2.yaml
@@ -3588,7 +3604,7 @@ libraries:
35883604
tag_format: '{id}-v{version}'
35893605
- id: google-cloud-translate
35903606
version: 3.25.0
3591-
last_generated_commit: 6df3ecf4fd43b64826de6a477d1a535ec18b0d7c
3607+
last_generated_commit: 2233f63baf69c2a481f30180045fcf036242781d
35923608
apis:
35933609
- path: google/cloud/translate/v3beta1
35943610
service_config: translate_v3beta1.yaml
@@ -4296,7 +4312,6 @@ libraries:
42964312
last_generated_commit: 6df3ecf4fd43b64826de6a477d1a535ec18b0d7c
42974313
apis:
42984314
- path: google/shopping/type
4299-
service_config: ""
43004315
source_roots:
43014316
- packages/google-shopping-type
43024317
preserve_regex:
@@ -4308,20 +4323,17 @@ libraries:
43084323
tag_format: '{id}-v{version}'
43094324
- id: googleapis-common-protos
43104325
version: 1.74.0
4311-
last_generated_commit: 582172de2d9b6443e1fecf696167867c6d8a5fc4
4326+
last_generated_commit: 2233f63baf69c2a481f30180045fcf036242781d
43124327
apis:
43134328
- path: google/api
43144329
service_config: serviceconfig.yaml
43154330
- path: google/cloud
4316-
service_config: ""
43174331
- path: google/cloud/location
43184332
service_config: cloud.yaml
43194333
- path: google/logging/type
4320-
service_config: ""
43214334
- path: google/rpc
43224335
service_config: rpc_publish.yaml
43234336
- path: google/rpc/context
4324-
service_config: ""
43254337
- path: google/type
43264338
service_config: type.yaml
43274339
source_roots:

packages/bigframes/bigframes/core/pyformat.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
import string
2323
import typing
24-
from typing import Any, Optional, Union
24+
from typing import Any, Optional, Tuple, Union
2525

2626
import google.cloud.bigquery
2727
import pandas
@@ -39,7 +39,11 @@
3939

4040

4141
def _table_to_sql(table: _BQ_TABLE_TYPES) -> str:
42-
return f"`{table.project}`.`{table.dataset_id}`.`{table.table_id}`"
42+
# BiglakeIcebergTable IDs have 4 parts. BigFrames packs catalog.namespace
43+
# into the dataset_id.
44+
dataset_parts = table.dataset_id.split(".")
45+
dataset_sql = ".".join(f"`{part}`" for part in dataset_parts)
46+
return f"`{table.project}`.{dataset_sql}.`{table.table_id}`"
4347

4448

4549
def _pandas_df_to_sql_dry_run(pd_df: pandas.DataFrame) -> str:
@@ -102,6 +106,24 @@ def _field_to_template_value(
102106
return _pandas_df_to_sql(value, session=session, dry_run=dry_run, name=name)
103107

104108
if isinstance(value, bigframes.dataframe.DataFrame):
109+
import bigframes.core.bq_data as bq_data
110+
import bigframes.core.nodes as nodes
111+
112+
# TODO(b/493608478): Remove this workaround for BigLake/Iceberg tables,
113+
# which cannot currently be used in views, once a fix rolls out.
114+
def is_biglake(
115+
node: nodes.BigFrameNode, child_results: Tuple[bool, ...]
116+
) -> bool:
117+
if isinstance(node, nodes.ReadTableNode):
118+
return isinstance(node.source.table, bq_data.BiglakeIcebergTable)
119+
return any(child_results)
120+
121+
contains_biglake = value._block.expr.node.reduce_up(is_biglake)
122+
123+
if contains_biglake:
124+
sql_query, _, _ = value._to_sql_query(include_index=True)
125+
return f"({sql_query})"
126+
105127
return _table_to_sql(value._to_placeholder_table(dry_run=dry_run))
106128

107129
if isinstance(value, str):

packages/bigframes/bigframes/session/_io/bigquery/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -515,9 +515,13 @@ def to_query(
515515
time_travel_timestamp: Optional[datetime.datetime] = None,
516516
) -> str:
517517
"""Compile query_or_table with conditions(filters, wildcards) to query."""
518-
sub_query = (
519-
f"({query_or_table})" if is_query(query_or_table) else f"`{query_or_table}`"
520-
)
518+
if is_query(query_or_table):
519+
sub_query = f"({query_or_table})"
520+
else:
521+
# Table ID can have 1, 2, 3, or 4 parts. Quoting all parts to be safe.
522+
# See: https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#identifiers
523+
parts = query_or_table.split(".")
524+
sub_query = ".".join(f"`{part}`" for part in parts)
521525

522526
# TODO(b/338111344): Generate an index based on DefaultIndexKind if we
523527
# don't have index columns specified.

packages/bigframes/tests/unit/core/test_pyformat.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,15 @@ def test_pyformat_with_query_string_replaces_variables(session):
500500
),
501501
"SELECT * FROM `ListedProject`.`ListedDataset`.`ListedTable`",
502502
),
503+
(
504+
google.cloud.bigquery.TableReference(
505+
google.cloud.bigquery.DatasetReference(
506+
"my-project", "my-catalog.my-namespace"
507+
),
508+
"my-table",
509+
),
510+
"SELECT * FROM `my-project`.`my-catalog`.`my-namespace`.`my-table`",
511+
),
503512
),
504513
)
505514
def test_pyformat_with_table_replaces_variables(table, expected_sql, session=session):
@@ -511,3 +520,51 @@ def test_pyformat_with_table_replaces_variables(table, expected_sql, session=ses
511520
sql = "SELECT * FROM {table}"
512521
got_sql = pyformat.pyformat(sql, pyformat_args=pyformat_args, session=session)
513522
assert got_sql == expected_sql
523+
524+
525+
def test_pyformat_with_bigframes_dataframe_biglake_table(session):
526+
# Create a real BigFrames DataFrame that points to a BigLake table.
527+
import bigframes.core.array_value as array_value
528+
import bigframes.core.blocks as blocks
529+
import bigframes.core.bq_data as bq_data
530+
import bigframes.dataframe
531+
532+
# Define the BigLake table
533+
project_id = "my-project"
534+
catalog_id = "my-catalog"
535+
namespace_id = "my-namespace"
536+
table_id = "my-table"
537+
schema = (google.cloud.bigquery.SchemaField("col", "INTEGER"),)
538+
539+
biglake_table = bq_data.BiglakeIcebergTable(
540+
project_id=project_id,
541+
catalog_id=catalog_id,
542+
namespace_id=namespace_id,
543+
table_id=table_id,
544+
physical_schema=schema,
545+
cluster_cols=(),
546+
metadata=bq_data.TableMetadata(
547+
location=bq_data.BigQueryRegion("us-central1"),
548+
type="TABLE",
549+
),
550+
)
551+
552+
# ArrayValue.from_table is what read_gbq uses.
553+
av = array_value.ArrayValue.from_table(biglake_table, session)
554+
block = blocks.Block(av, index_columns=[], column_labels=["col"])
555+
df = bigframes.dataframe.DataFrame(block)
556+
557+
pyformat_args = {"df": df}
558+
sql = "SELECT * FROM {df}"
559+
560+
got_sql = pyformat.pyformat(sql, pyformat_args=pyformat_args, session=session)
561+
562+
# For BigLake, we now expect a SUBQUERY, not a view reference.
563+
# The subquery should have correctly quoted 4-part ID.
564+
assert "SELECT" in got_sql
565+
assert project_id in got_sql
566+
assert catalog_id in got_sql
567+
assert namespace_id in got_sql
568+
assert table_id in got_sql
569+
assert got_sql.startswith("SELECT * FROM (SELECT")
570+
assert got_sql.endswith(")")

packages/google-apps-chat/google/apps/chat/__init__.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,21 @@
111111
ListReactionsResponse,
112112
Reaction,
113113
)
114+
from google.apps.chat_v1.types.section import (
115+
CreateSectionRequest,
116+
DeleteSectionRequest,
117+
ListSectionItemsRequest,
118+
ListSectionItemsResponse,
119+
ListSectionsRequest,
120+
ListSectionsResponse,
121+
MoveSectionItemRequest,
122+
MoveSectionItemResponse,
123+
PositionSectionRequest,
124+
PositionSectionResponse,
125+
Section,
126+
SectionItem,
127+
UpdateSectionRequest,
128+
)
114129
from google.apps.chat_v1.types.slash_command import SlashCommand
115130
from google.apps.chat_v1.types.space import (
116131
CompleteImportSpaceRequest,
@@ -230,6 +245,19 @@
230245
"ListReactionsRequest",
231246
"ListReactionsResponse",
232247
"Reaction",
248+
"CreateSectionRequest",
249+
"DeleteSectionRequest",
250+
"ListSectionItemsRequest",
251+
"ListSectionItemsResponse",
252+
"ListSectionsRequest",
253+
"ListSectionsResponse",
254+
"MoveSectionItemRequest",
255+
"MoveSectionItemResponse",
256+
"PositionSectionRequest",
257+
"PositionSectionResponse",
258+
"Section",
259+
"SectionItem",
260+
"UpdateSectionRequest",
233261
"SlashCommand",
234262
"CompleteImportSpaceRequest",
235263
"CompleteImportSpaceResponse",

0 commit comments

Comments
 (0)