Skip to content

Commit

Permalink
feat: expose DataFrame.bqclient to assist in integrations (#519)
Browse files Browse the repository at this point in the history
* feat: expose `DataFrame.session` to assist in integrations

* add code sample for sharing when the service account is only known on the backend

* expose bqclient instead

* start a DF construction sample

* finish read sample
  • Loading branch information
tswast authored Mar 27, 2024
1 parent 3692095 commit 0be8911
Show file tree
Hide file tree
Showing 3 changed files with 662 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bigframes/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,11 @@ def empty(self) -> bool:
def values(self) -> numpy.ndarray:
return self.to_numpy()

@property
def bqclient(self) -> bigframes.Session:
"""BigQuery REST API Client the DataFrame uses for operations."""
return self._session.bqclient

@property
def _session(self) -> bigframes.Session:
return self._get_block().expr.session
Expand Down
22 changes: 22 additions & 0 deletions notebooks/dataframes/dataframe.ipynb
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "eeec3428",
"metadata": {},
"outputs": [],
"source": [
"# Copyright 2023 Google LLC\n",
"#\n",
"# Licensed under the Apache License, Version 2.0 (the \"License\");\n",
"# you may not use this file except in compliance with the License.\n",
"# You may obtain a copy of the License at\n",
"#\n",
"# https://www.apache.org/licenses/LICENSE-2.0\n",
"#\n",
"# Unless required by applicable law or agreed to in writing, software\n",
"# distributed under the License is distributed on an \"AS IS\" BASIS,\n",
"# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n",
"# See the License for the specific language governing permissions and\n",
"# limitations under the License."
]
},
{
"attachments": {},
"cell_type": "markdown",
Expand Down
Loading

0 comments on commit 0be8911

Please sign in to comment.