Client for Google Cloud Bigquery Connection API
class google.cloud.bigquery.connection_v1.CloudSqlCredential(mapping=None, *, ignore_unknown_fields=False, **kwargs)
Credential info for the Cloud SQL.
username()
The username for the credential.
Type
password()
The password for the credential.
Type
_delattr_(key)
Delete the value on the given field.
This is generally equivalent to setting a falsy value.
_eq_(other)
Return True if the messages are equal, False otherwise.
_ne_(other)
Return True if the messages are unequal, False otherwise.
_setattr_(key, value)
Set the value on the given field.
For well-known protocol buffer types which are marshalled, either the protocol buffer object or the Python equivalent is accepted.
class google.cloud.bigquery.connection_v1.CloudSqlProperties(mapping=None, *, ignore_unknown_fields=False, **kwargs)
Connection properties specific to the Cloud SQL.
instance_id()
Cloud SQL instance ID in the form
project:location:instance
.
Type
database()
Database name.
Type
type()
Type of the Cloud SQL database.
Type
DatabaseType
credential()
Input only. Cloud SQL credential.
Type
CloudSqlCredential
class DatabaseType(value)
Supported Cloud SQL database types.
_delattr_(key)
Delete the value on the given field.
This is generally equivalent to setting a falsy value.
_eq_(other)
Return True if the messages are equal, False otherwise.
_ne_(other)
Return True if the messages are unequal, False otherwise.
_setattr_(key, value)
Set the value on the given field.
For well-known protocol buffer types which are marshalled, either the protocol buffer object or the Python equivalent is accepted.
class google.cloud.bigquery.connection_v1.Connection(mapping=None, *, ignore_unknown_fields=False, **kwargs)
Configuration parameters to establish connection with an external data source, except the credential attributes.
name()
The resource name of the connection in the form of:
projects/{project_id}/locations/{location_id}/connections/{connection_id}
Type
friendly_name()
User provided display name for the connection.
Type
description()
User provided description.
Type
cloud_sql()
Cloud SQL properties.
Type
CloudSqlProperties
creation_time()
Output only. The creation timestamp of the connection.
Type
last_modified_time()
Output only. The last update timestamp of the connection.
Type
has_credential()
Output only. True, if credential is configured for this connection.
Type
_delattr_(key)
Delete the value on the given field.
This is generally equivalent to setting a falsy value.
_eq_(other)
Return True if the messages are equal, False otherwise.
_ne_(other)
Return True if the messages are unequal, False otherwise.
_setattr_(key, value)
Set the value on the given field.
For well-known protocol buffer types which are marshalled, either the protocol buffer object or the Python equivalent is accepted.
class google.cloud.bigquery.connection_v1.ConnectionServiceClient(*, credentials: google.auth.credentials.Credentials = None, transport: Union[str, google.cloud.bigquery.connection_v1.services.connection_service.transports.base.ConnectionServiceTransport] = None, client_options: <module 'google.api_core.client_options' from '/workspace/python-bigquery-connection/.nox/docfx/lib/python3.9/site-packages/google/api_core/client_options.py'> = None)
Manages external data source connections and credentials.
Instantiate the connection service client.
Parameters
credentials (Optional[google.auth.credentials.Credentials]) – The authorization credentials to attach to requests. These credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment.
transport (Union[str, **ConnectionServiceTransport]) – The transport to use. If set to None, a transport is chosen automatically.
client_options (ClientOptions) – Custom options for the client. (1) The
api_endpoint
property can be used to override the default endpoint provided by the client. (2) Iftransport
argument is None,client_options
can be used to create a mutual TLS transport. Ifclient_cert_source
is provided, mutual TLS transport will be created with the givenapi_endpoint
or the default mTLS endpoint, and the client SSL credentials obtained fromclient_cert_source
.
Raises
google.auth.exceptions.MutualTlsChannelError – If mutual TLS transport creation failed for any reason.
static connection_path(project: str, location: str, connection: str)
Return a fully-qualified connection string.
create_connection(request: Optional[google.cloud.bigquery.connection_v1.types.connection.CreateConnectionRequest] = None, *, parent: Optional[str] = None, connection: Optional[google.cloud.bigquery.connection_v1.types.connection.Connection] = None, connection_id: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE:
Creates a new connection.
Parameters
request (
CreateConnectionRequest
) – The request object. The request for [ConnectionService.CreateConnection][google.cloud.bigquery.connection.v1.ConnectionService.CreateConnection].parent (
str
) – Required. Parent resource name. Must be in the formatprojects/{project_id}/locations/{location_id}
This corresponds to theparent
field on therequest
instance; ifrequest
is provided, this should not be set.connection (
Connection
) – Required. Connection to create. This corresponds to theconnection
field on therequest
instance; ifrequest
is provided, this should not be set.connection_id (
str
) – Optional. Connection id that should be assigned to the created connection. This corresponds to theconnection_id
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, *[str](https://python.readthedocs.io/en/latest/library/stdtypes.html#str)]*]) – Strings which should be sent along with the request as metadata.
Returns
Configuration parameters to establish connection with an external data source, except the credential attributes.
Return type
Connection
delete_connection(request: Optional[google.cloud.bigquery.connection_v1.types.connection.DeleteConnectionRequest] = None, *, name: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE:
Deletes connection and associated credential.
Parameters
request (
DeleteConnectionRequest
) – The request object. The request for [ConnectionService.DeleteConnectionRequest][].name (
str
) – Required. Name of the deleted connection, for example:projects/{project_id}/locations/{location_id}/connections/{connection_id}
This corresponds to thename
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, *[str](https://python.readthedocs.io/en/latest/library/stdtypes.html#str)]*]) – Strings which should be sent along with the request as metadata.
classmethod from_service_account_file(filename: str, *args, **kwargs)
Creates an instance of this client using the provided credentials file.
Parameters
filename (str) – The path to the service account private key json file.
args – Additional arguments to pass to the constructor.
kwargs – Additional arguments to pass to the constructor.
Returns
The constructed client.
Return type
classmethod from_service_account_json(filename: str, *args, **kwargs)
Creates an instance of this client using the provided credentials file.
Parameters
filename (str) – The path to the service account private key json file.
args – Additional arguments to pass to the constructor.
kwargs – Additional arguments to pass to the constructor.
Returns
The constructed client.
Return type
get_connection(request: Optional[google.cloud.bigquery.connection_v1.types.connection.GetConnectionRequest] = None, *, name: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE:
Returns specified connection.
Parameters
request (
GetConnectionRequest
) – The request object. The request for [ConnectionService.GetConnection][google.cloud.bigquery.connection.v1.ConnectionService.GetConnection].name (
str
) – Required. Name of the requested connection, for example:projects/{project_id}/locations/{location_id}/connections/{connection_id}
This corresponds to thename
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, *[str](https://python.readthedocs.io/en/latest/library/stdtypes.html#str)]*]) – Strings which should be sent along with the request as metadata.
Returns
Configuration parameters to establish connection with an external data source, except the credential attributes.
Return type
Connection
get_iam_policy(request: Optional[google.iam.v1.iam_policy_pb2.GetIamPolicyRequest] = None, *, resource: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE:
Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
Parameters
request (
GetIamPolicyRequest
) – The request object. Request message for GetIamPolicy method.resource (
str
) – REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field. This corresponds to theresource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, *[str](https://python.readthedocs.io/en/latest/library/stdtypes.html#str)]*]) – Strings which should be sent along with the request as metadata.
Returns
Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources.
A
Policy
is a collection ofbindings
. Abinding
binds one or moremembers
to a singlerole
. Members can be user accounts, service accounts, Google groups, and domains (such as G Suite). Arole
is a named list of permissions (defined by IAM or configured by users). Abinding
can optionally specify acondition
, which is a logic expression that further constrains the role binding based on attributes about the request and/or target resource.JSON Example
{ "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": ["user:eve@example.com"], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ] }
YAML Example
bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
For a description of IAM and its features, see the IAM developer’s guide.
Return type
Policy
list_connections(request: Optional[google.cloud.bigquery.connection_v1.types.connection.ListConnectionsRequest] = None, *, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE:
Returns a list of connections in the given project.
Parameters
request (
ListConnectionsRequest
) – The request object. The request for [ConnectionService.ListConnections][google.cloud.bigquery.connection.v1.ConnectionService.ListConnections].retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, *[str](https://python.readthedocs.io/en/latest/library/stdtypes.html#str)]*]) – Strings which should be sent along with the request as metadata.
Returns
The response for [ConnectionService.ListConnections][google.cloud.bigquery.connection.v1.ConnectionService.ListConnections].
Iterating over this object will yield results and resolve additional pages automatically.
Return type
ListConnectionsPager
static parse_connection_path(path: str)
Parse a connection path into its component segments.
set_iam_policy(request: Optional[google.iam.v1.iam_policy_pb2.SetIamPolicyRequest] = None, *, resource: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE:
Sets the access control policy on the specified resource. Replaces any existing policy.
Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED
Parameters
request (
SetIamPolicyRequest
) – The request object. Request message for SetIamPolicy method.resource (
str
) – REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field. This corresponds to theresource
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, *[str](https://python.readthedocs.io/en/latest/library/stdtypes.html#str)]*]) – Strings which should be sent along with the request as metadata.
Returns
Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources.
A
Policy
is a collection ofbindings
. Abinding
binds one or moremembers
to a singlerole
. Members can be user accounts, service accounts, Google groups, and domains (such as G Suite). Arole
is a named list of permissions (defined by IAM or configured by users). Abinding
can optionally specify acondition
, which is a logic expression that further constrains the role binding based on attributes about the request and/or target resource.JSON Example
{ "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": ["user:eve@example.com"], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ] }
YAML Example
bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
For a description of IAM and its features, see the IAM developer’s guide.
Return type
Policy
test_iam_permissions(request: Optional[google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest] = None, *, resource: Optional[str] = None, permissions: Optional[Sequence[str]] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE:
Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.
Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may “fail open” without warning.
Parameters
request (
TestIamPermissionsRequest
) – The request object. Request message for TestIamPermissions method.resource (
str
) – REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field. This corresponds to theresource
field on therequest
instance; ifrequest
is provided, this should not be set.permissions (
Sequence[str]
) – The set of permissions to check for theresource
. Permissions with wildcards (such as ‘*’ or ‘storage.*’) are not allowed. For more information see IAM Overview. This corresponds to thepermissions
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, *[str](https://python.readthedocs.io/en/latest/library/stdtypes.html#str)]*]) – Strings which should be sent along with the request as metadata.
Returns
Response message for
TestIamPermissions
method.Return type
TestIamPermissionsResponse
update_connection(request: Optional[google.cloud.bigquery.connection_v1.types.connection.UpdateConnectionRequest] = None, *, name: Optional[str] = None, connection: Optional[google.cloud.bigquery.connection_v1.types.connection.Connection] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE:
Updates the specified connection. For security reasons, also resets credential if connection properties are in the update field mask.
Parameters
request (
UpdateConnectionRequest
) – The request object. The request for [ConnectionService.UpdateConnection][google.cloud.bigquery.connection.v1.ConnectionService.UpdateConnection].name (
str
) – Required. Name of the connection to update, for example:projects/{project_id}/locations/{location_id}/connections/{connection_id}
This corresponds to thename
field on therequest
instance; ifrequest
is provided, this should not be set.connection (
Connection
) – Required. Connection containing the updated fields. This corresponds to theconnection
field on therequest
instance; ifrequest
is provided, this should not be set.update_mask (
FieldMask
) – Required. Update mask for the connection fields to be updated. This corresponds to theupdate_mask
field on therequest
instance; ifrequest
is provided, this should not be set.retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.
timeout (float) – The timeout for this request.
metadata (Sequence[Tuple[str, *[str](https://python.readthedocs.io/en/latest/library/stdtypes.html#str)]*]) – Strings which should be sent along with the request as metadata.
Returns
Configuration parameters to establish connection with an external data source, except the credential attributes.
Return type
Connection
class google.cloud.bigquery.connection_v1.CreateConnectionRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)
The request for [ConnectionService.CreateConnection][google.cloud.bigquery.connection.v1.ConnectionService.CreateConnection].
parent()
Required. Parent resource name. Must be in the format
projects/{project_id}/locations/{location_id}
Type
connection_id()
Optional. Connection id that should be assigned to the created connection.
Type
connection()
Required. Connection to create.
Type
Connection
_delattr_(key)
Delete the value on the given field.
This is generally equivalent to setting a falsy value.
_eq_(other)
Return True if the messages are equal, False otherwise.
_ne_(other)
Return True if the messages are unequal, False otherwise.
_setattr_(key, value)
Set the value on the given field.
For well-known protocol buffer types which are marshalled, either the protocol buffer object or the Python equivalent is accepted.
class google.cloud.bigquery.connection_v1.DeleteConnectionRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)
The request for [ConnectionService.DeleteConnectionRequest][].
name()
Required. Name of the deleted connection, for example:
projects/{project_id}/locations/{location_id}/connections/{connection_id}
Type
_delattr_(key)
Delete the value on the given field.
This is generally equivalent to setting a falsy value.
_eq_(other)
Return True if the messages are equal, False otherwise.
_ne_(other)
Return True if the messages are unequal, False otherwise.
_setattr_(key, value)
Set the value on the given field.
For well-known protocol buffer types which are marshalled, either the protocol buffer object or the Python equivalent is accepted.
class google.cloud.bigquery.connection_v1.GetConnectionRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)
The request for [ConnectionService.GetConnection][google.cloud.bigquery.connection.v1.ConnectionService.GetConnection].
name()
Required. Name of the requested connection, for example:
projects/{project_id}/locations/{location_id}/connections/{connection_id}
Type
_delattr_(key)
Delete the value on the given field.
This is generally equivalent to setting a falsy value.
_eq_(other)
Return True if the messages are equal, False otherwise.
_ne_(other)
Return True if the messages are unequal, False otherwise.
_setattr_(key, value)
Set the value on the given field.
For well-known protocol buffer types which are marshalled, either the protocol buffer object or the Python equivalent is accepted.
class google.cloud.bigquery.connection_v1.ListConnectionsRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)
The request for [ConnectionService.ListConnections][google.cloud.bigquery.connection.v1.ConnectionService.ListConnections].
parent()
Required. Parent resource name. Must be in the form:
projects/{project_id}/locations/{location_id}
Type
page_size()
Required. Page size.
Type
page_token()
Page token.
Type
_delattr_(key)
Delete the value on the given field.
This is generally equivalent to setting a falsy value.
_eq_(other)
Return True if the messages are equal, False otherwise.
_ne_(other)
Return True if the messages are unequal, False otherwise.
_setattr_(key, value)
Set the value on the given field.
For well-known protocol buffer types which are marshalled, either the protocol buffer object or the Python equivalent is accepted.
class google.cloud.bigquery.connection_v1.ListConnectionsResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)
The response for [ConnectionService.ListConnections][google.cloud.bigquery.connection.v1.ConnectionService.ListConnections].
next_page_token()
Next page token.
Type
connections()
List of connections.
Type
Sequence[Connection]
_delattr_(key)
Delete the value on the given field.
This is generally equivalent to setting a falsy value.
_eq_(other)
Return True if the messages are equal, False otherwise.
_ne_(other)
Return True if the messages are unequal, False otherwise.
_setattr_(key, value)
Set the value on the given field.
For well-known protocol buffer types which are marshalled, either the protocol buffer object or the Python equivalent is accepted.
class google.cloud.bigquery.connection_v1.UpdateConnectionRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)
The request for [ConnectionService.UpdateConnection][google.cloud.bigquery.connection.v1.ConnectionService.UpdateConnection].
name()
Required. Name of the connection to update, for example:
projects/{project_id}/locations/{location_id}/connections/{connection_id}
Type
connection()
Required. Connection containing the updated fields.
Type
Connection
update_mask()
Required. Update mask for the connection fields to be updated.
Type
FieldMask
_delattr_(key)
Delete the value on the given field.
This is generally equivalent to setting a falsy value.
_eq_(other)
Return True if the messages are equal, False otherwise.
_ne_(other)
Return True if the messages are unequal, False otherwise.
_setattr_(key, value)
Set the value on the given field.
For well-known protocol buffer types which are marshalled, either the protocol buffer object or the Python equivalent is accepted.