Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove the unused connection_client from the remote function #824

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 2 additions & 19 deletions bigframes/functions/remote_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
import google.api_core.retry
from google.cloud import (
bigquery,
bigquery_connection_v1,
functions_v2,
resourcemanager_v3,
)
Expand Down Expand Up @@ -654,9 +653,6 @@ def remote_function(
output_type: Optional[type] = None,
session: Optional[Session] = None,
bigquery_client: Optional[bigquery.Client] = None,
bigquery_connection_client: Optional[
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change. Please detect if this is set and warn with a FutureWarning that this argument is deprecated, instead.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Are we allowed to check in the breaking change? I do find it very confusing as a customer.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the savior is that this is marked as deprecated for external use, so we can make a breaking change here?

bigquery_connection_v1.ConnectionServiceClient
] = None,
cloud_functions_client: Optional[functions_v2.FunctionServiceClient] = None,
resource_manager_client: Optional[resourcemanager_v3.ProjectsClient] = None,
dataset: Optional[str] = None,
Expand Down Expand Up @@ -728,10 +724,6 @@ def remote_function(
bigquery_client (google.cloud.bigquery.Client, Optional):
Client to use for BigQuery operations. If this param is not provided
then bigquery client from the session would be used.
bigquery_connection_client (google.cloud.bigquery_connection_v1.ConnectionServiceClient, Optional):
Client to use for BigQuery connection operations. If this param is
not provided then bigquery connection client from the session would
be used.
cloud_functions_client (google.cloud.functions_v2.FunctionServiceClient, Optional):
Client to use for cloud functions operations. If this param is not
provided then the functions client from the session would be used.
Expand All @@ -750,8 +742,8 @@ def remote_function(
If this param is not provided then the bigquery connection from the session
would be used. If it is pre created in the same location as the
`bigquery_client.location` then it would be used, otherwise it is created
dynamically using the `bigquery_connection_client` assuming the user has necessary
priviliges. The PROJECT_ID should be the same as the BigQuery connection project.
dynamically assuming the user has necessary priviliges. The PROJECT_ID
should be the same as the BigQuery connection project.
reuse (bool, Optional):
Reuse the remote function if is already exists.
`True` by default, which results in reusing an existing remote
Expand Down Expand Up @@ -849,15 +841,6 @@ def remote_function(
f"{constants.FEEDBACK_LINK}"
)

# A BigQuery connection client is required to perform BQ connection operations
if not bigquery_connection_client:
bigquery_connection_client = session.bqconnectionclient
if not bigquery_connection_client:
raise ValueError(
"A bigquery connection client must be provided, either directly or via session. "
f"{constants.FEEDBACK_LINK}"
)

# A cloud functions client is required to perform cloud functions operations
if not cloud_functions_client:
cloud_functions_client = session.cloudfunctionsclient
Expand Down
12 changes: 0 additions & 12 deletions tests/system/small/test_remote_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ def session_with_bq_connection(
@pytest.mark.flaky(retries=2, delay=120)
def test_remote_function_direct_no_session_param(
bigquery_client,
bigqueryconnection_client,
cloudfunctions_client,
resourcemanager_client,
scalars_dfs,
Expand All @@ -100,7 +99,6 @@ def test_remote_function_direct_no_session_param(
[int],
int,
bigquery_client=bigquery_client,
bigquery_connection_client=bigqueryconnection_client,
cloud_functions_client=cloudfunctions_client,
resource_manager_client=resourcemanager_client,
dataset=dataset_id_permanent,
Expand Down Expand Up @@ -146,7 +144,6 @@ def square(x):
@pytest.mark.flaky(retries=2, delay=120)
def test_remote_function_direct_no_session_param_location_specified(
bigquery_client,
bigqueryconnection_client,
cloudfunctions_client,
resourcemanager_client,
scalars_dfs,
Expand All @@ -157,7 +154,6 @@ def test_remote_function_direct_no_session_param_location_specified(
[int],
int,
bigquery_client=bigquery_client,
bigquery_connection_client=bigqueryconnection_client,
cloud_functions_client=cloudfunctions_client,
resource_manager_client=resourcemanager_client,
dataset=dataset_id_permanent,
Expand Down Expand Up @@ -198,7 +194,6 @@ def square(x):
@pytest.mark.flaky(retries=2, delay=120)
def test_remote_function_direct_no_session_param_location_mismatched(
bigquery_client,
bigqueryconnection_client,
cloudfunctions_client,
resourcemanager_client,
dataset_id_permanent,
Expand All @@ -213,7 +208,6 @@ def test_remote_function_direct_no_session_param_location_mismatched(
[int],
int,
bigquery_client=bigquery_client,
bigquery_connection_client=bigqueryconnection_client,
cloud_functions_client=cloudfunctions_client,
resource_manager_client=resourcemanager_client,
dataset=dataset_id_permanent,
Expand All @@ -230,7 +224,6 @@ def square(x):
@pytest.mark.flaky(retries=2, delay=120)
def test_remote_function_direct_no_session_param_location_project_specified(
bigquery_client,
bigqueryconnection_client,
cloudfunctions_client,
resourcemanager_client,
scalars_dfs,
Expand All @@ -241,7 +234,6 @@ def test_remote_function_direct_no_session_param_location_project_specified(
[int],
int,
bigquery_client=bigquery_client,
bigquery_connection_client=bigqueryconnection_client,
cloud_functions_client=cloudfunctions_client,
resource_manager_client=resourcemanager_client,
dataset=dataset_id_permanent,
Expand Down Expand Up @@ -282,7 +274,6 @@ def square(x):
@pytest.mark.flaky(retries=2, delay=120)
def test_remote_function_direct_no_session_param_project_mismatched(
bigquery_client,
bigqueryconnection_client,
cloudfunctions_client,
resourcemanager_client,
dataset_id_permanent,
Expand All @@ -299,7 +290,6 @@ def test_remote_function_direct_no_session_param_project_mismatched(
[int],
int,
bigquery_client=bigquery_client,
bigquery_connection_client=bigqueryconnection_client,
cloud_functions_client=cloudfunctions_client,
resource_manager_client=resourcemanager_client,
dataset=dataset_id_permanent,
Expand Down Expand Up @@ -563,7 +553,6 @@ def test_read_gbq_function_detects_invalid_function(session, dataset_id):
def test_read_gbq_function_like_original(
session,
bigquery_client,
bigqueryconnection_client,
cloudfunctions_client,
resourcemanager_client,
scalars_df_index,
Expand All @@ -574,7 +563,6 @@ def test_read_gbq_function_like_original(
[int],
int,
bigquery_client=bigquery_client,
bigquery_connection_client=bigqueryconnection_client,
dataset=dataset_id_permanent,
cloud_functions_client=cloudfunctions_client,
resource_manager_client=resourcemanager_client,
Expand Down