From 6257ad76ba12d6bdbeac46260ae8b749f4397f91 Mon Sep 17 00:00:00 2001 From: Matthew Laurence Chen Date: Mon, 5 Aug 2024 18:38:33 -0400 Subject: [PATCH 1/4] first commit: - add myself to OWNERS - done to test if I set up --- OWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/OWNERS b/OWNERS index f86ad551ef..5d2a1c2de9 100644 --- a/OWNERS +++ b/OWNERS @@ -10,3 +10,4 @@ kemppeterson@google.com shobs@google.com swast@google.com tbergeron@google.com +mlaurencechen@google.com From f5e843204b9de687edf8f21a848566d1f69d5a14 Mon Sep 17 00:00:00 2001 From: Matthew Laurence Chen Date: Tue, 6 Aug 2024 07:02:11 -0400 Subject: [PATCH 2/4] Revert "first commit:" This reverts commit 6257ad76ba12d6bdbeac46260ae8b749f4397f91. --- OWNERS | 1 - 1 file changed, 1 deletion(-) diff --git a/OWNERS b/OWNERS index 5d2a1c2de9..f86ad551ef 100644 --- a/OWNERS +++ b/OWNERS @@ -10,4 +10,3 @@ kemppeterson@google.com shobs@google.com swast@google.com tbergeron@google.com -mlaurencechen@google.com From b506c4c4cc0c3ce37e644a9376f444ae4117a403 Mon Sep 17 00:00:00 2001 From: Matthew Laurence Chen Date: Fri, 30 Aug 2024 14:05:53 +0000 Subject: [PATCH 3/4] chore: allow setting table labels in `to_gbq` --- bigframes/dataframe.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bigframes/dataframe.py b/bigframes/dataframe.py index 649b097e92..d0ea7dda83 100644 --- a/bigframes/dataframe.py +++ b/bigframes/dataframe.py @@ -3045,6 +3045,7 @@ def to_gbq( index: bool = True, ordering_id: Optional[str] = None, clustering_columns: Union[pandas.Index, Iterable[typing.Hashable]] = (), + labels : dict[str, str] = {} ) -> str: dispositions = { "fail": bigquery.WriteDisposition.WRITE_EMPTY, @@ -3120,6 +3121,12 @@ def to_gbq( + constants.DEFAULT_EXPIRATION, ) + if len(labels) != 0: + client = bigquery.Client() + table = client.get_table(destination_table) + table.labels = labels + client.update_table(table, ["labels"]) + return destination_table def to_numpy( From 0b09216e12ef1af8b4739a774222b10c2ad7b45f Mon Sep 17 00:00:00 2001 From: Matthew Laurence Chen Date: Fri, 30 Aug 2024 14:05:53 +0000 Subject: [PATCH 4/4] chore: allow setting table labels in `to_gbq` --- bigframes/dataframe.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bigframes/dataframe.py b/bigframes/dataframe.py index 649b097e92..9bde62d519 100644 --- a/bigframes/dataframe.py +++ b/bigframes/dataframe.py @@ -3045,6 +3045,7 @@ def to_gbq( index: bool = True, ordering_id: Optional[str] = None, clustering_columns: Union[pandas.Index, Iterable[typing.Hashable]] = (), + labels: dict[str, str] = {}, ) -> str: dispositions = { "fail": bigquery.WriteDisposition.WRITE_EMPTY, @@ -3120,6 +3121,12 @@ def to_gbq( + constants.DEFAULT_EXPIRATION, ) + if len(labels) != 0: + client = bigquery.Client() + table = client.get_table(destination_table) + table.labels = labels + client.update_table(table, ["labels"]) + return destination_table def to_numpy(