As of January 1, 2020 this library no longer supports Python 2 on the latest released version. Library versions released prior to that date will continue to be available. For more information please visit Python 2 support on Google Cloud.

DatabaseAdmin

class google.cloud.spanner_admin_database_v1.services.database_admin.DatabaseAdminAsyncClient(*, credentials: typing.Optional[google.auth.credentials.Credentials] = None, transport: typing.Optional[typing.Union[str, google.cloud.spanner_admin_database_v1.services.database_admin.transports.base.DatabaseAdminTransport, typing.Callable[[...], google.cloud.spanner_admin_database_v1.services.database_admin.transports.base.DatabaseAdminTransport]]] = 'grpc_asyncio', client_options: typing.Optional[google.api_core.client_options.ClientOptions] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)[source]

Cloud Spanner Database Admin API

The Cloud Spanner Database Admin API can be used to:

  • create, drop, and list databases

  • update the schema of pre-existing databases

  • create, delete, copy and list backups for a database

  • restore a database from an existing backup

Instantiates the database admin async 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 (Optional[Union[str,DatabaseAdminTransport,Callable[..., DatabaseAdminTransport]]]) – The transport to use, or a Callable that constructs and returns a new transport to use. If a Callable is given, it will be called with the same set of initialization arguments as used in the DatabaseAdminTransport constructor. If set to None, a transport is chosen automatically.

  • client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]) –

    Custom options for the client.

    1. The api_endpoint property can be used to override the default endpoint provided by the client when transport is not explicitly provided. Only if this property is not set and transport was not explicitly provided, the endpoint is determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment variable, which have one of the following values: “always” (always use the default mTLS endpoint), “never” (always use the default regular endpoint) and “auto” (auto-switch to the default mTLS endpoint if client certificate is present; this is the default value).

    2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is “true”, then the client_cert_source property can be used to provide a client certificate for mTLS transport. If not provided, the default SSL client certificate will be used if present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is “false” or not set, no client certificate will be used.

    3. The universe_domain property can be used to override the default “googleapis.com” universe. Note that api_endpoint property still takes precedence; and universe_domain is currently not supported for mTLS.

  • client_info (google.api_core.gapic_v1.client_info.ClientInfo) – The client info used to send a user-agent string along with API requests. If None, then default info will be used. Generally, you only need to set this if you’re developing your own client library.

Raises

google.auth.exceptions.MutualTlsChannelError – If mutual TLS transport creation failed for any reason.

property api_endpoint

Return the API endpoint used by the client instance.

Returns

The API endpoint used by the client instance.

Return type

str

static backup_path(project: str, instance: str, backup: str) str

Returns a fully-qualified backup string.

static backup_schedule_path(project: str, instance: str, database: str, schedule: str) str

Returns a fully-qualified backup_schedule string.

async cancel_operation(request: Optional[google.longrunning.operations_pb2.CancelOperationRequest] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None[source]

Starts asynchronous cancellation on a long-running operation.

The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn’t support this method, it returns google.rpc.Code.UNIMPLEMENTED.

Parameters
  • request (CancelOperationRequest) – The request object. Request message for CancelOperation method.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

None

static common_billing_account_path(billing_account: str) str

Returns a fully-qualified billing_account string.

static common_folder_path(folder: str) str

Returns a fully-qualified folder string.

static common_location_path(project: str, location: str) str

Returns a fully-qualified location string.

static common_organization_path(organization: str) str

Returns a fully-qualified organization string.

static common_project_path(project: str) str

Returns a fully-qualified project string.

async copy_backup(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.backup.CopyBackupRequest, dict]] = None, *, parent: Optional[str] = None, backup_id: Optional[str] = None, source_backup: Optional[str] = None, expire_time: Optional[google.protobuf.timestamp_pb2.Timestamp] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.operation_async.AsyncOperation[source]

Starts copying a Cloud Spanner Backup. The returned backup [long-running operation][google.longrunning.Operation] will have a name of the format projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id> and can be used to track copying of the backup. The operation is associated with the destination backup. The [metadata][google.longrunning.Operation.metadata] field type is [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]. The [response][google.longrunning.Operation.response] field type is [Backup][google.spanner.admin.database.v1.Backup], if successful. Cancelling the returned operation will stop the copying and delete the destination backup. Concurrent CopyBackup requests can run on the same source backup.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

async def sample_copy_backup():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminAsyncClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.CopyBackupRequest(
        parent="parent_value",
        backup_id="backup_id_value",
        source_backup="source_backup_value",
    )

    # Make the request
    operation = client.copy_backup(request=request)

    print("Waiting for operation to complete...")

    response = (await operation).result()

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.cloud.spanner_admin_database_v1.types.CopyBackupRequest, dict]]) – The request object. The request for [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup].

  • parent (str) –

    Required. The name of the destination instance that will contain the backup copy. Values are of the form: projects/<project>/instances/<instance>.

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • backup_id (str) –

    Required. The id of the backup copy. The backup_id appended to parent forms the full backup_uri of the form projects/<project>/instances/<instance>/backups/<backup>.

    This corresponds to the backup_id field on the request instance; if request is provided, this should not be set.

  • source_backup (str) –

    Required. The source backup to be copied. The source backup needs to be in READY state for it to be copied. Once CopyBackup is in progress, the source backup cannot be deleted or cleaned up on expiration until CopyBackup is finished. Values are of the form: projects/<project>/instances/<instance>/backups/<backup>.

    This corresponds to the source_backup field on the request instance; if request is provided, this should not be set.

  • expire_time (google.protobuf.timestamp_pb2.Timestamp) –

    Required. The expiration time of the backup in microsecond granularity. The expiration time must be at least 6 hours and at most 366 days from the create_time of the source backup. Once the expire_time has passed, the backup is eligible to be automatically deleted by Cloud Spanner to free the resources used by the backup.

    This corresponds to the expire_time field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

An object representing a long-running operation.

The result type for the operation will be google.cloud.spanner_admin_database_v1.types.Backup A backup of a Cloud Spanner database.

Return type

google.api_core.operation_async.AsyncOperation

async create_backup(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.backup.CreateBackupRequest, dict]] = None, *, parent: Optional[str] = None, backup: Optional[google.cloud.spanner_admin_database_v1.types.backup.Backup] = None, backup_id: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.operation_async.AsyncOperation[source]

Starts creating a new Cloud Spanner Backup. The returned backup [long-running operation][google.longrunning.Operation] will have a name of the format projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id> and can be used to track creation of the backup. The [metadata][google.longrunning.Operation.metadata] field type is [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. The [response][google.longrunning.Operation.response] field type is [Backup][google.spanner.admin.database.v1.Backup], if successful. Cancelling the returned operation will stop the creation and delete the backup. There can be only one pending backup creation per database. Backup creation of different databases can run concurrently.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

async def sample_create_backup():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminAsyncClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.CreateBackupRequest(
        parent="parent_value",
        backup_id="backup_id_value",
    )

    # Make the request
    operation = client.create_backup(request=request)

    print("Waiting for operation to complete...")

    response = (await operation).result()

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.cloud.spanner_admin_database_v1.types.CreateBackupRequest, dict]]) – The request object. The request for [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup].

  • parent (str) –

    Required. The name of the instance in which the backup will be created. This must be the same instance that contains the database the backup will be created from. The backup will be stored in the location(s) specified in the instance configuration of this instance. Values are of the form projects/<project>/instances/<instance>.

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • backup (google.cloud.spanner_admin_database_v1.types.Backup) – Required. The backup to create. This corresponds to the backup field on the request instance; if request is provided, this should not be set.

  • backup_id (str) –

    Required. The id of the backup to be created. The backup_id appended to parent forms the full backup name of the form projects/<project>/instances/<instance>/backups/<backup_id>.

    This corresponds to the backup_id field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

An object representing a long-running operation.

The result type for the operation will be google.cloud.spanner_admin_database_v1.types.Backup A backup of a Cloud Spanner database.

Return type

google.api_core.operation_async.AsyncOperation

async create_backup_schedule(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.backup_schedule.CreateBackupScheduleRequest, dict]] = None, *, parent: Optional[str] = None, backup_schedule: Optional[google.cloud.spanner_admin_database_v1.types.backup_schedule.BackupSchedule] = None, backup_schedule_id: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.spanner_admin_database_v1.types.backup_schedule.BackupSchedule[source]

Creates a new backup schedule.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

async def sample_create_backup_schedule():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminAsyncClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.CreateBackupScheduleRequest(
        parent="parent_value",
        backup_schedule_id="backup_schedule_id_value",
    )

    # Make the request
    response = await client.create_backup_schedule(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.cloud.spanner_admin_database_v1.types.CreateBackupScheduleRequest, dict]]) – The request object. The request for [CreateBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackupSchedule].

  • parent (str) –

    Required. The name of the database that this backup schedule applies to.

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • backup_schedule (google.cloud.spanner_admin_database_v1.types.BackupSchedule) –

    Required. The backup schedule to create.

    This corresponds to the backup_schedule field on the request instance; if request is provided, this should not be set.

  • backup_schedule_id (str) –

    Required. The Id to use for the backup schedule. The backup_schedule_id appended to parent forms the full backup schedule name of the form projects/<project>/instances/<instance>/databases/<database>/backupSchedules/<backup_schedule_id>.

    This corresponds to the backup_schedule_id field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

BackupSchedule expresses the automated backup creation specification for a Spanner database. Next ID: 10

Return type

google.cloud.spanner_admin_database_v1.types.BackupSchedule

async create_database(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.CreateDatabaseRequest, dict]] = None, *, parent: Optional[str] = None, create_statement: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.operation_async.AsyncOperation[source]

Creates a new Cloud Spanner database and starts to prepare it for serving. The returned [long-running operation][google.longrunning.Operation] will have a name of the format <database_name>/operations/<operation_id> and can be used to track preparation of the database. The [metadata][google.longrunning.Operation.metadata] field type is [CreateDatabaseMetadata][google.spanner.admin.database.v1.CreateDatabaseMetadata]. The [response][google.longrunning.Operation.response] field type is [Database][google.spanner.admin.database.v1.Database], if successful.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

async def sample_create_database():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminAsyncClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.CreateDatabaseRequest(
        parent="parent_value",
        create_statement="create_statement_value",
    )

    # Make the request
    operation = client.create_database(request=request)

    print("Waiting for operation to complete...")

    response = (await operation).result()

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.cloud.spanner_admin_database_v1.types.CreateDatabaseRequest, dict]]) – The request object. The request for [CreateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.CreateDatabase].

  • parent (str) –

    Required. The name of the instance that will serve the new database. Values are of the form projects/<project>/instances/<instance>.

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • create_statement (str) –

    Required. A CREATE DATABASE statement, which specifies the ID of the new database. The database ID must conform to the regular expression [a-z][a-z0-9_\-]*[a-z0-9] and be between 2 and 30 characters in length. If the database ID is a reserved word or if it contains a hyphen, the database ID must be enclosed in backticks (`).

    This corresponds to the create_statement field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

An object representing a long-running operation.

The result type for the operation will be google.cloud.spanner_admin_database_v1.types.Database A Cloud Spanner database.

Return type

google.api_core.operation_async.AsyncOperation

static crypto_key_path(project: str, location: str, key_ring: str, crypto_key: str) str

Returns a fully-qualified crypto_key string.

static crypto_key_version_path(project: str, location: str, key_ring: str, crypto_key: str, crypto_key_version: str) str

Returns a fully-qualified crypto_key_version string.

static database_path(project: str, instance: str, database: str) str

Returns a fully-qualified database string.

static database_role_path(project: str, instance: str, database: str, role: str) str

Returns a fully-qualified database_role string.

async delete_backup(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.backup.DeleteBackupRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None[source]

Deletes a pending or completed [Backup][google.spanner.admin.database.v1.Backup].

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

async def sample_delete_backup():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminAsyncClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.DeleteBackupRequest(
        name="name_value",
    )

    # Make the request
    await client.delete_backup(request=request)
Parameters
  • request (Optional[Union[google.cloud.spanner_admin_database_v1.types.DeleteBackupRequest, dict]]) – The request object. The request for [DeleteBackup][google.spanner.admin.database.v1.DatabaseAdmin.DeleteBackup].

  • name (str) –

    Required. Name of the backup to delete. Values are of the form projects/<project>/instances/<instance>/backups/<backup>.

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

async delete_backup_schedule(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.backup_schedule.DeleteBackupScheduleRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None[source]

Deletes a backup schedule.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

async def sample_delete_backup_schedule():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminAsyncClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.DeleteBackupScheduleRequest(
        name="name_value",
    )

    # Make the request
    await client.delete_backup_schedule(request=request)
Parameters
  • request (Optional[Union[google.cloud.spanner_admin_database_v1.types.DeleteBackupScheduleRequest, dict]]) – The request object. The request for [DeleteBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.DeleteBackupSchedule].

  • name (str) –

    Required. The name of the schedule to delete. Values are of the form projects/<project>/instances/<instance>/databases/<database>/backupSchedules/<backup_schedule_id>.

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

async delete_operation(request: Optional[google.longrunning.operations_pb2.DeleteOperationRequest] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None[source]

Deletes a long-running operation.

This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn’t support this method, it returns google.rpc.Code.UNIMPLEMENTED.

Parameters
  • request (DeleteOperationRequest) – The request object. Request message for DeleteOperation method.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

None

async drop_database(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.DropDatabaseRequest, dict]] = None, *, database: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None[source]

Drops (aka deletes) a Cloud Spanner database. Completed backups for the database will be retained according to their expire_time. Note: Cloud Spanner might continue to accept requests for a few seconds after the database has been deleted.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

async def sample_drop_database():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminAsyncClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.DropDatabaseRequest(
        database="database_value",
    )

    # Make the request
    await client.drop_database(request=request)
Parameters
  • request (Optional[Union[google.cloud.spanner_admin_database_v1.types.DropDatabaseRequest, dict]]) – The request object. The request for [DropDatabase][google.spanner.admin.database.v1.DatabaseAdmin.DropDatabase].

  • database (str) – Required. The database to be dropped. This corresponds to the database field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

classmethod from_service_account_file(filename: str, *args, **kwargs)[source]
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

DatabaseAdminAsyncClient

classmethod from_service_account_info(info: dict, *args, **kwargs)[source]
Creates an instance of this client using the provided credentials

info.

Parameters
  • info (dict) – The service account private key info.

  • args – Additional arguments to pass to the constructor.

  • kwargs – Additional arguments to pass to the constructor.

Returns

The constructed client.

Return type

DatabaseAdminAsyncClient

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

DatabaseAdminAsyncClient

async get_backup(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.backup.GetBackupRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.spanner_admin_database_v1.types.backup.Backup[source]

Gets metadata on a pending or completed [Backup][google.spanner.admin.database.v1.Backup].

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

async def sample_get_backup():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminAsyncClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.GetBackupRequest(
        name="name_value",
    )

    # Make the request
    response = await client.get_backup(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.cloud.spanner_admin_database_v1.types.GetBackupRequest, dict]]) – The request object. The request for [GetBackup][google.spanner.admin.database.v1.DatabaseAdmin.GetBackup].

  • name (str) –

    Required. Name of the backup. Values are of the form projects/<project>/instances/<instance>/backups/<backup>.

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A backup of a Cloud Spanner database.

Return type

google.cloud.spanner_admin_database_v1.types.Backup

async get_backup_schedule(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.backup_schedule.GetBackupScheduleRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.spanner_admin_database_v1.types.backup_schedule.BackupSchedule[source]

Gets backup schedule for the input schedule name.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

async def sample_get_backup_schedule():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminAsyncClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.GetBackupScheduleRequest(
        name="name_value",
    )

    # Make the request
    response = await client.get_backup_schedule(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.cloud.spanner_admin_database_v1.types.GetBackupScheduleRequest, dict]]) – The request object. The request for [GetBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.GetBackupSchedule].

  • name (str) –

    Required. The name of the schedule to retrieve. Values are of the form projects/<project>/instances/<instance>/databases/<database>/backupSchedules/<backup_schedule_id>.

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

BackupSchedule expresses the automated backup creation specification for a Spanner database. Next ID: 10

Return type

google.cloud.spanner_admin_database_v1.types.BackupSchedule

async get_database(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.GetDatabaseRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.spanner_admin_database_v1.types.spanner_database_admin.Database[source]

Gets the state of a Cloud Spanner database.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

async def sample_get_database():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminAsyncClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.GetDatabaseRequest(
        name="name_value",
    )

    # Make the request
    response = await client.get_database(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.cloud.spanner_admin_database_v1.types.GetDatabaseRequest, dict]]) – The request object. The request for [GetDatabase][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabase].

  • name (str) –

    Required. The name of the requested database. Values are of the form projects/<project>/instances/<instance>/databases/<database>.

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A Cloud Spanner database.

Return type

google.cloud.spanner_admin_database_v1.types.Database

async get_database_ddl(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.GetDatabaseDdlRequest, dict]] = None, *, database: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.spanner_admin_database_v1.types.spanner_database_admin.GetDatabaseDdlResponse[source]

Returns the schema of a Cloud Spanner database as a list of formatted DDL statements. This method does not show pending schema updates, those may be queried using the [Operations][google.longrunning.Operations] API.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

async def sample_get_database_ddl():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminAsyncClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.GetDatabaseDdlRequest(
        database="database_value",
    )

    # Make the request
    response = await client.get_database_ddl(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.cloud.spanner_admin_database_v1.types.GetDatabaseDdlRequest, dict]]) – The request object. The request for [GetDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl].

  • database (str) –

    Required. The database whose schema we wish to get. Values are of the form projects/<project>/instances/<instance>/databases/<database>

    This corresponds to the database field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

The response for

[GetDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl].

Return type

google.cloud.spanner_admin_database_v1.types.GetDatabaseDdlResponse

async get_iam_policy(request: Optional[Union[google.iam.v1.iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, resource: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.iam.v1.policy_pb2.Policy[source]

Gets the access control policy for a database or backup resource. Returns an empty policy if a database or backup exists but does not have a policy set.

Authorization requires spanner.databases.getIamPolicy permission on [resource][google.iam.v1.GetIamPolicyRequest.resource]. For backups, authorization requires spanner.backups.getIamPolicy permission on [resource][google.iam.v1.GetIamPolicyRequest.resource].

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1
from google.iam.v1 import iam_policy_pb2  # type: ignore

async def sample_get_iam_policy():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminAsyncClient()

    # Initialize request argument(s)
    request = iam_policy_pb2.GetIamPolicyRequest(
        resource="resource_value",
    )

    # Make the request
    response = await client.get_iam_policy(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.iam.v1.iam_policy_pb2.GetIamPolicyRequest, dict]]) – 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 the resource field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

An Identity and Access Management (IAM) policy, which specifies access

controls for Google Cloud resources.

A Policy is a collection of bindings. A binding binds one or more members, or principals, to a single role. Principals can be user accounts, service accounts, Google groups, and domains (such as G Suite). A role is a named list of permissions; each role can be an IAM predefined role or a user-created custom role.

For some types of Google Cloud resources, a binding can also specify a condition, which is a logical expression that allows access to a resource only if the expression evaluates to true. A condition can add constraints based on attributes of the request, the resource, or both. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).

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')",           }         }       ],       "etag": "BwWWja0YfJA=",       "version": 3     }`

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')     etag: BwWWja0YfJA=     version: 3`

For a description of IAM and its features, see the [IAM documentation](https://cloud.google.com/iam/docs/).

Return type

google.iam.v1.policy_pb2.Policy

classmethod get_mtls_endpoint_and_cert_source(client_options: Optional[google.api_core.client_options.ClientOptions] = None)[source]

Return the API endpoint and client cert source for mutual TLS.

The client cert source is determined in the following order: (1) if GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is not “true”, the client cert source is None. (2) if client_options.client_cert_source is provided, use the provided one; if the default client cert source exists, use the default one; otherwise the client cert source is None.

The API endpoint is determined in the following order: (1) if client_options.api_endpoint if provided, use the provided one. (2) if GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is “always”, use the default mTLS endpoint; if the environment variable is “never”, use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint.

More details can be found at https://google.aip.dev/auth/4114.

Parameters

client_options (google.api_core.client_options.ClientOptions) – Custom options for the client. Only the api_endpoint and client_cert_source properties may be used in this method.

Returns

returns the API endpoint and the

client cert source to use.

Return type

Tuple[str, Callable[[], Tuple[bytes, bytes]]]

Raises

google.auth.exceptions.MutualTLSChannelError – If any errors happen.

async get_operation(request: Optional[google.longrunning.operations_pb2.GetOperationRequest] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.longrunning.operations_pb2.Operation[source]

Gets the latest state of a long-running operation.

Parameters
  • request (GetOperationRequest) – The request object. Request message for GetOperation method.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

An Operation object.

Return type

Operation

classmethod get_transport_class(label: Optional[str] = None) Type[google.cloud.spanner_admin_database_v1.services.database_admin.transports.base.DatabaseAdminTransport]

Returns an appropriate transport class.

Parameters

label – The name of the desired transport. If none is provided, then the first transport in the registry is used.

Returns

The transport class to use.

static instance_path(project: str, instance: str) str

Returns a fully-qualified instance string.

async list_backup_operations(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.backup.ListBackupOperationsRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListBackupOperationsAsyncPager[source]

Lists the backup [long-running operations][google.longrunning.Operation] in the given instance. A backup operation has a name of the form projects/<project>/instances/<instance>/backups/<backup>/operations/<operation>. The long-running operation [metadata][google.longrunning.Operation.metadata] field type metadata.type_url describes the type of the metadata. Operations returned include those that have completed/failed/canceled within the last 7 days, and pending operations. Operations returned are ordered by operation.metadata.value.progress.start_time in descending order starting from the most recently started operation.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

async def sample_list_backup_operations():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminAsyncClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.ListBackupOperationsRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_backup_operations(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
  • request (Optional[Union[google.cloud.spanner_admin_database_v1.types.ListBackupOperationsRequest, dict]]) – The request object. The request for [ListBackupOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations].

  • parent (str) –

    Required. The instance of the backup operations. Values are of the form projects/<project>/instances/<instance>.

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

The response for

[ListBackupOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations].

Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListBackupOperationsAsyncPager

async list_backup_schedules(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.backup_schedule.ListBackupSchedulesRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListBackupSchedulesAsyncPager[source]

Lists all the backup schedules for the database.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

async def sample_list_backup_schedules():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminAsyncClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.ListBackupSchedulesRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_backup_schedules(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
  • request (Optional[Union[google.cloud.spanner_admin_database_v1.types.ListBackupSchedulesRequest, dict]]) – The request object. The request for [ListBackupSchedules][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules].

  • parent (str) –

    Required. Database is the parent resource whose backup schedules should be listed. Values are of the form projects/<project>/instances/<instance>/databases/<database>

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

The response for

[ListBackupSchedules][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules].

Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListBackupSchedulesAsyncPager

async list_backups(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.backup.ListBackupsRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListBackupsAsyncPager[source]

Lists completed and pending backups. Backups returned are ordered by create_time in descending order, starting from the most recent create_time.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

async def sample_list_backups():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminAsyncClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.ListBackupsRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_backups(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
  • request (Optional[Union[google.cloud.spanner_admin_database_v1.types.ListBackupsRequest, dict]]) – The request object. The request for [ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups].

  • parent (str) –

    Required. The instance to list backups from. Values are of the form projects/<project>/instances/<instance>.

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

The response for

[ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups].

Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListBackupsAsyncPager

async list_database_operations(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.ListDatabaseOperationsRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListDatabaseOperationsAsyncPager[source]

Lists database [longrunning-operations][google.longrunning.Operation]. A database operation has a name of the form projects/<project>/instances/<instance>/databases/<database>/operations/<operation>. The long-running operation [metadata][google.longrunning.Operation.metadata] field type metadata.type_url describes the type of the metadata. Operations returned include those that have completed/failed/canceled within the last 7 days, and pending operations.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

async def sample_list_database_operations():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminAsyncClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.ListDatabaseOperationsRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_database_operations(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
  • request (Optional[Union[google.cloud.spanner_admin_database_v1.types.ListDatabaseOperationsRequest, dict]]) – The request object. The request for [ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations].

  • parent (str) –

    Required. The instance of the database operations. Values are of the form projects/<project>/instances/<instance>.

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

The response for

[ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations].

Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListDatabaseOperationsAsyncPager

async list_database_roles(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.ListDatabaseRolesRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListDatabaseRolesAsyncPager[source]

Lists Cloud Spanner database roles.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

async def sample_list_database_roles():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminAsyncClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.ListDatabaseRolesRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_database_roles(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
  • request (Optional[Union[google.cloud.spanner_admin_database_v1.types.ListDatabaseRolesRequest, dict]]) – The request object. The request for [ListDatabaseRoles][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles].

  • parent (str) –

    Required. The database whose roles should be listed. Values are of the form projects/<project>/instances/<instance>/databases/<database>.

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

The response for

[ListDatabaseRoles][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles].

Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListDatabaseRolesAsyncPager

async list_databases(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.ListDatabasesRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListDatabasesAsyncPager[source]

Lists Cloud Spanner databases.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

async def sample_list_databases():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminAsyncClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.ListDatabasesRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_databases(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
  • request (Optional[Union[google.cloud.spanner_admin_database_v1.types.ListDatabasesRequest, dict]]) – The request object. The request for [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases].

  • parent (str) –

    Required. The instance whose databases should be listed. Values are of the form projects/<project>/instances/<instance>.

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

The response for

[ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases].

Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListDatabasesAsyncPager

async list_operations(request: Optional[google.longrunning.operations_pb2.ListOperationsRequest] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.longrunning.operations_pb2.ListOperationsResponse[source]

Lists operations that match the specified filter in the request.

Parameters
  • request (ListOperationsRequest) – The request object. Request message for ListOperations method.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Response message for ListOperations method.

Return type

ListOperationsResponse

static parse_backup_path(path: str) Dict[str, str]

Parses a backup path into its component segments.

static parse_backup_schedule_path(path: str) Dict[str, str]

Parses a backup_schedule path into its component segments.

static parse_common_billing_account_path(path: str) Dict[str, str]

Parse a billing_account path into its component segments.

static parse_common_folder_path(path: str) Dict[str, str]

Parse a folder path into its component segments.

static parse_common_location_path(path: str) Dict[str, str]

Parse a location path into its component segments.

static parse_common_organization_path(path: str) Dict[str, str]

Parse a organization path into its component segments.

static parse_common_project_path(path: str) Dict[str, str]

Parse a project path into its component segments.

static parse_crypto_key_path(path: str) Dict[str, str]

Parses a crypto_key path into its component segments.

static parse_crypto_key_version_path(path: str) Dict[str, str]

Parses a crypto_key_version path into its component segments.

static parse_database_path(path: str) Dict[str, str]

Parses a database path into its component segments.

static parse_database_role_path(path: str) Dict[str, str]

Parses a database_role path into its component segments.

static parse_instance_path(path: str) Dict[str, str]

Parses a instance path into its component segments.

async restore_database(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.RestoreDatabaseRequest, dict]] = None, *, parent: Optional[str] = None, database_id: Optional[str] = None, backup: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.operation_async.AsyncOperation[source]

Create a new database by restoring from a completed backup. The new database must be in the same project and in an instance with the same instance configuration as the instance containing the backup. The returned database [long-running operation][google.longrunning.Operation] has a name of the format projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>, and can be used to track the progress of the operation, and to cancel it. The [metadata][google.longrunning.Operation.metadata] field type is [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]. The [response][google.longrunning.Operation.response] type is [Database][google.spanner.admin.database.v1.Database], if successful. Cancelling the returned operation will stop the restore and delete the database. There can be only one database being restored into an instance at a time. Once the restore operation completes, a new restore operation can be initiated, without waiting for the optimize operation associated with the first restore to complete.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

async def sample_restore_database():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminAsyncClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.RestoreDatabaseRequest(
        backup="backup_value",
        parent="parent_value",
        database_id="database_id_value",
    )

    # Make the request
    operation = client.restore_database(request=request)

    print("Waiting for operation to complete...")

    response = (await operation).result()

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.cloud.spanner_admin_database_v1.types.RestoreDatabaseRequest, dict]]) – The request object. The request for [RestoreDatabase][google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase].

  • parent (str) –

    Required. The name of the instance in which to create the restored database. This instance must be in the same project and have the same instance configuration as the instance containing the source backup. Values are of the form projects/<project>/instances/<instance>.

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • database_id (str) –

    Required. The id of the database to create and restore to. This database must not already exist. The database_id appended to parent forms the full database name of the form projects/<project>/instances/<instance>/databases/<database_id>.

    This corresponds to the database_id field on the request instance; if request is provided, this should not be set.

  • backup (str) –

    Name of the backup from which to restore. Values are of the form projects/<project>/instances/<instance>/backups/<backup>.

    This corresponds to the backup field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

An object representing a long-running operation.

The result type for the operation will be google.cloud.spanner_admin_database_v1.types.Database A Cloud Spanner database.

Return type

google.api_core.operation_async.AsyncOperation

async set_iam_policy(request: Optional[Union[google.iam.v1.iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, resource: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.iam.v1.policy_pb2.Policy[source]

Sets the access control policy on a database or backup resource. Replaces any existing policy.

Authorization requires spanner.databases.setIamPolicy permission on [resource][google.iam.v1.SetIamPolicyRequest.resource]. For backups, authorization requires spanner.backups.setIamPolicy permission on [resource][google.iam.v1.SetIamPolicyRequest.resource].

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1
from google.iam.v1 import iam_policy_pb2  # type: ignore

async def sample_set_iam_policy():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminAsyncClient()

    # Initialize request argument(s)
    request = iam_policy_pb2.SetIamPolicyRequest(
        resource="resource_value",
    )

    # Make the request
    response = await client.set_iam_policy(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.iam.v1.iam_policy_pb2.SetIamPolicyRequest, dict]]) – 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 the resource field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

An Identity and Access Management (IAM) policy, which specifies access

controls for Google Cloud resources.

A Policy is a collection of bindings. A binding binds one or more members, or principals, to a single role. Principals can be user accounts, service accounts, Google groups, and domains (such as G Suite). A role is a named list of permissions; each role can be an IAM predefined role or a user-created custom role.

For some types of Google Cloud resources, a binding can also specify a condition, which is a logical expression that allows access to a resource only if the expression evaluates to true. A condition can add constraints based on attributes of the request, the resource, or both. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).

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')",           }         }       ],       "etag": "BwWWja0YfJA=",       "version": 3     }`

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')     etag: BwWWja0YfJA=     version: 3`

For a description of IAM and its features, see the [IAM documentation](https://cloud.google.com/iam/docs/).

Return type

google.iam.v1.policy_pb2.Policy

async test_iam_permissions(request: Optional[Union[google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, resource: Optional[str] = None, permissions: Optional[MutableSequence[str]] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.iam.v1.iam_policy_pb2.TestIamPermissionsResponse[source]

Returns permissions that the caller has on the specified database or backup resource.

Attempting this RPC on a non-existent Cloud Spanner database will result in a NOT_FOUND error if the user has spanner.databases.list permission on the containing Cloud Spanner instance. Otherwise returns an empty set of permissions. Calling this method on a backup that does not exist will result in a NOT_FOUND error if the user has spanner.backups.list permission on the containing instance.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1
from google.iam.v1 import iam_policy_pb2  # type: ignore

async def sample_test_iam_permissions():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminAsyncClient()

    # Initialize request argument(s)
    request = iam_policy_pb2.TestIamPermissionsRequest(
        resource="resource_value",
        permissions=['permissions_value1', 'permissions_value2'],
    )

    # Make the request
    response = await client.test_iam_permissions(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest, dict]]) – 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 the resource field on the request instance; if request is provided, this should not be set.

  • permissions (MutableSequence[str]) –

    The set of permissions to check for the resource. Permissions with wildcards (such as ‘*’ or ‘storage.*’) are not allowed. For more information see IAM Overview.

    This corresponds to the permissions field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Response message for TestIamPermissions method.

Return type

google.iam.v1.iam_policy_pb2.TestIamPermissionsResponse

property transport: google.cloud.spanner_admin_database_v1.services.database_admin.transports.base.DatabaseAdminTransport

Returns the transport used by the client instance.

Returns

The transport used by the client instance.

Return type

DatabaseAdminTransport

property universe_domain: str

Return the universe domain used by the client instance.

Returns

The universe domain used

by the client instance.

Return type

str

async update_backup(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.backup.UpdateBackupRequest, dict]] = None, *, backup: Optional[google.cloud.spanner_admin_database_v1.types.backup.Backup] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.spanner_admin_database_v1.types.backup.Backup[source]

Updates a pending or completed [Backup][google.spanner.admin.database.v1.Backup].

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

async def sample_update_backup():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminAsyncClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.UpdateBackupRequest(
    )

    # Make the request
    response = await client.update_backup(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.cloud.spanner_admin_database_v1.types.UpdateBackupRequest, dict]]) – The request object. The request for [UpdateBackup][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackup].

  • backup (google.cloud.spanner_admin_database_v1.types.Backup) –

    Required. The backup to update. backup.name, and the fields to be updated as specified by update_mask are required. Other fields are ignored. Update is only supported for the following fields:

    • backup.expire_time.

    This corresponds to the backup field on the request instance; if request is provided, this should not be set.

  • update_mask (google.protobuf.field_mask_pb2.FieldMask) –

    Required. A mask specifying which fields (e.g. expire_time) in the Backup resource should be updated. This mask is relative to the Backup resource, not to the request message. The field mask must always be specified; this prevents any future fields from being erased accidentally by clients that do not know about them.

    This corresponds to the update_mask field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A backup of a Cloud Spanner database.

Return type

google.cloud.spanner_admin_database_v1.types.Backup

async update_backup_schedule(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.backup_schedule.UpdateBackupScheduleRequest, dict]] = None, *, backup_schedule: Optional[google.cloud.spanner_admin_database_v1.types.backup_schedule.BackupSchedule] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.spanner_admin_database_v1.types.backup_schedule.BackupSchedule[source]

Updates a backup schedule.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

async def sample_update_backup_schedule():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminAsyncClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.UpdateBackupScheduleRequest(
    )

    # Make the request
    response = await client.update_backup_schedule(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.cloud.spanner_admin_database_v1.types.UpdateBackupScheduleRequest, dict]]) – The request object. The request for [UpdateBackupScheduleRequest][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackupSchedule].

  • backup_schedule (google.cloud.spanner_admin_database_v1.types.BackupSchedule) –

    Required. The backup schedule to update. backup_schedule.name, and the fields to be updated as specified by update_mask are required. Other fields are ignored.

    This corresponds to the backup_schedule field on the request instance; if request is provided, this should not be set.

  • update_mask (google.protobuf.field_mask_pb2.FieldMask) –

    Required. A mask specifying which fields in the BackupSchedule resource should be updated. This mask is relative to the BackupSchedule resource, not to the request message. The field mask must always be specified; this prevents any future fields from being erased accidentally.

    This corresponds to the update_mask field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

BackupSchedule expresses the automated backup creation specification for a Spanner database. Next ID: 10

Return type

google.cloud.spanner_admin_database_v1.types.BackupSchedule

async update_database(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.UpdateDatabaseRequest, dict]] = None, *, database: Optional[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.Database] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.operation_async.AsyncOperation[source]

Updates a Cloud Spanner database. The returned [long-running operation][google.longrunning.Operation] can be used to track the progress of updating the database. If the named database does not exist, returns NOT_FOUND.

While the operation is pending:

  • The database’s [reconciling][google.spanner.admin.database.v1.Database.reconciling] field is set to true.

  • Cancelling the operation is best-effort. If the cancellation succeeds, the operation metadata’s [cancel_time][google.spanner.admin.database.v1.UpdateDatabaseMetadata.cancel_time] is set, the updates are reverted, and the operation terminates with a CANCELLED status.

  • New UpdateDatabase requests will return a FAILED_PRECONDITION error until the pending operation is done (returns successfully or with error).

  • Reading the database via the API continues to give the pre-request values.

Upon completion of the returned operation:

  • The new values are in effect and readable via the API.

  • The database’s [reconciling][google.spanner.admin.database.v1.Database.reconciling] field becomes false.

The returned [long-running operation][google.longrunning.Operation] will have a name of the format projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id> and can be used to track the database modification. The [metadata][google.longrunning.Operation.metadata] field type is [UpdateDatabaseMetadata][google.spanner.admin.database.v1.UpdateDatabaseMetadata]. The [response][google.longrunning.Operation.response] field type is [Database][google.spanner.admin.database.v1.Database], if successful.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

async def sample_update_database():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminAsyncClient()

    # Initialize request argument(s)
    database = spanner_admin_database_v1.Database()
    database.name = "name_value"

    request = spanner_admin_database_v1.UpdateDatabaseRequest(
        database=database,
    )

    # Make the request
    operation = client.update_database(request=request)

    print("Waiting for operation to complete...")

    response = (await operation).result()

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.cloud.spanner_admin_database_v1.types.UpdateDatabaseRequest, dict]]) – The request object. The request for [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase].

  • database (google.cloud.spanner_admin_database_v1.types.Database) –

    Required. The database to update. The name field of the database is of the form projects/<project>/instances/<instance>/databases/<database>.

    This corresponds to the database field on the request instance; if request is provided, this should not be set.

  • update_mask (google.protobuf.field_mask_pb2.FieldMask) –

    Required. The list of fields to update. Currently, only enable_drop_protection field can be updated.

    This corresponds to the update_mask field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

An object representing a long-running operation.

The result type for the operation will be google.cloud.spanner_admin_database_v1.types.Database A Cloud Spanner database.

Return type

google.api_core.operation_async.AsyncOperation

async update_database_ddl(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.UpdateDatabaseDdlRequest, dict]] = None, *, database: Optional[str] = None, statements: Optional[MutableSequence[str]] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.operation_async.AsyncOperation[source]

Updates the schema of a Cloud Spanner database by creating/altering/dropping tables, columns, indexes, etc. The returned [long-running operation][google.longrunning.Operation] will have a name of the format <database_name>/operations/<operation_id> and can be used to track execution of the schema change(s). The [metadata][google.longrunning.Operation.metadata] field type is [UpdateDatabaseDdlMetadata][google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata]. The operation has no response.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

async def sample_update_database_ddl():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminAsyncClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.UpdateDatabaseDdlRequest(
        database="database_value",
        statements=['statements_value1', 'statements_value2'],
    )

    # Make the request
    operation = client.update_database_ddl(request=request)

    print("Waiting for operation to complete...")

    response = (await operation).result()

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.cloud.spanner_admin_database_v1.types.UpdateDatabaseDdlRequest, dict]]) –

    The request object. Enqueues the given DDL statements to be applied, in order but not necessarily all at once, to the database schema at some point (or points) in the future. The server checks that the statements are executable (syntactically valid, name tables that exist, etc.) before enqueueing them, but they may still fail upon later execution (e.g., if a statement from another batch of statements is applied first and it conflicts in some way, or if there is some data-related problem like a NULL value in a column to which NOT NULL would be added). If a statement fails, all subsequent statements in the batch are automatically cancelled.

    Each batch of statements is assigned a name which can be used with the [Operations][google.longrunning.Operations] API to monitor progress. See the [operation_id][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.operation_id] field for more details.

  • database (str) – Required. The database to update. This corresponds to the database field on the request instance; if request is provided, this should not be set.

  • statements (MutableSequence[str]) –

    Required. DDL statements to be applied to the database.

    This corresponds to the statements field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

An object representing a long-running operation.

The result type for the operation will be google.protobuf.empty_pb2.Empty A generic empty message that you can re-use to avoid defining duplicated

empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance:

service Foo {

rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);

}

Return type

google.api_core.operation_async.AsyncOperation

class google.cloud.spanner_admin_database_v1.services.database_admin.DatabaseAdminClient(*, credentials: typing.Optional[google.auth.credentials.Credentials] = None, transport: typing.Optional[typing.Union[str, google.cloud.spanner_admin_database_v1.services.database_admin.transports.base.DatabaseAdminTransport, typing.Callable[[...], google.cloud.spanner_admin_database_v1.services.database_admin.transports.base.DatabaseAdminTransport]]] = None, client_options: typing.Optional[typing.Union[google.api_core.client_options.ClientOptions, dict]] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)[source]

Cloud Spanner Database Admin API

The Cloud Spanner Database Admin API can be used to:

  • create, drop, and list databases

  • update the schema of pre-existing databases

  • create, delete, copy and list backups for a database

  • restore a database from an existing backup

Instantiates the database admin 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 (Optional[Union[str,DatabaseAdminTransport,Callable[..., DatabaseAdminTransport]]]) – The transport to use, or a Callable that constructs and returns a new transport. If a Callable is given, it will be called with the same set of initialization arguments as used in the DatabaseAdminTransport constructor. If set to None, a transport is chosen automatically.

  • client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]) –

    Custom options for the client.

    1. The api_endpoint property can be used to override the default endpoint provided by the client when transport is not explicitly provided. Only if this property is not set and transport was not explicitly provided, the endpoint is determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment variable, which have one of the following values: “always” (always use the default mTLS endpoint), “never” (always use the default regular endpoint) and “auto” (auto-switch to the default mTLS endpoint if client certificate is present; this is the default value).

    2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is “true”, then the client_cert_source property can be used to provide a client certificate for mTLS transport. If not provided, the default SSL client certificate will be used if present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is “false” or not set, no client certificate will be used.

    3. The universe_domain property can be used to override the default “googleapis.com” universe. Note that the api_endpoint property still takes precedence; and universe_domain is currently not supported for mTLS.

  • client_info (google.api_core.gapic_v1.client_info.ClientInfo) – The client info used to send a user-agent string along with API requests. If None, then default info will be used. Generally, you only need to set this if you’re developing your own client library.

Raises

google.auth.exceptions.MutualTLSChannelError – If mutual TLS transport creation failed for any reason.

__exit__(type, value, traceback)[source]

Releases underlying transport’s resources.

Warning

ONLY use as a context manager if the transport is NOT shared with other clients! Exiting the with block will CLOSE the transport and may cause errors in other clients!

property api_endpoint

Return the API endpoint used by the client instance.

Returns

The API endpoint used by the client instance.

Return type

str

static backup_path(project: str, instance: str, backup: str) str[source]

Returns a fully-qualified backup string.

static backup_schedule_path(project: str, instance: str, database: str, schedule: str) str[source]

Returns a fully-qualified backup_schedule string.

cancel_operation(request: Optional[google.longrunning.operations_pb2.CancelOperationRequest] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None[source]

Starts asynchronous cancellation on a long-running operation.

The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn’t support this method, it returns google.rpc.Code.UNIMPLEMENTED.

Parameters
  • request (CancelOperationRequest) – The request object. Request message for CancelOperation method.

  • 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]]) – Strings which should be sent along with the request as metadata.

Returns

None

static common_billing_account_path(billing_account: str) str[source]

Returns a fully-qualified billing_account string.

static common_folder_path(folder: str) str[source]

Returns a fully-qualified folder string.

static common_location_path(project: str, location: str) str[source]

Returns a fully-qualified location string.

static common_organization_path(organization: str) str[source]

Returns a fully-qualified organization string.

static common_project_path(project: str) str[source]

Returns a fully-qualified project string.

copy_backup(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.backup.CopyBackupRequest, dict]] = None, *, parent: Optional[str] = None, backup_id: Optional[str] = None, source_backup: Optional[str] = None, expire_time: Optional[google.protobuf.timestamp_pb2.Timestamp] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.operation.Operation[source]

Starts copying a Cloud Spanner Backup. The returned backup [long-running operation][google.longrunning.Operation] will have a name of the format projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id> and can be used to track copying of the backup. The operation is associated with the destination backup. The [metadata][google.longrunning.Operation.metadata] field type is [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]. The [response][google.longrunning.Operation.response] field type is [Backup][google.spanner.admin.database.v1.Backup], if successful. Cancelling the returned operation will stop the copying and delete the destination backup. Concurrent CopyBackup requests can run on the same source backup.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

def sample_copy_backup():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.CopyBackupRequest(
        parent="parent_value",
        backup_id="backup_id_value",
        source_backup="source_backup_value",
    )

    # Make the request
    operation = client.copy_backup(request=request)

    print("Waiting for operation to complete...")

    response = operation.result()

    # Handle the response
    print(response)
Parameters
  • request (Union[google.cloud.spanner_admin_database_v1.types.CopyBackupRequest, dict]) – The request object. The request for [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup].

  • parent (str) –

    Required. The name of the destination instance that will contain the backup copy. Values are of the form: projects/<project>/instances/<instance>.

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • backup_id (str) –

    Required. The id of the backup copy. The backup_id appended to parent forms the full backup_uri of the form projects/<project>/instances/<instance>/backups/<backup>.

    This corresponds to the backup_id field on the request instance; if request is provided, this should not be set.

  • source_backup (str) –

    Required. The source backup to be copied. The source backup needs to be in READY state for it to be copied. Once CopyBackup is in progress, the source backup cannot be deleted or cleaned up on expiration until CopyBackup is finished. Values are of the form: projects/<project>/instances/<instance>/backups/<backup>.

    This corresponds to the source_backup field on the request instance; if request is provided, this should not be set.

  • expire_time (google.protobuf.timestamp_pb2.Timestamp) –

    Required. The expiration time of the backup in microsecond granularity. The expiration time must be at least 6 hours and at most 366 days from the create_time of the source backup. Once the expire_time has passed, the backup is eligible to be automatically deleted by Cloud Spanner to free the resources used by the backup.

    This corresponds to the expire_time field on the request instance; if request 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]]) – Strings which should be sent along with the request as metadata.

Returns

An object representing a long-running operation.

The result type for the operation will be google.cloud.spanner_admin_database_v1.types.Backup A backup of a Cloud Spanner database.

Return type

google.api_core.operation.Operation

create_backup(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.backup.CreateBackupRequest, dict]] = None, *, parent: Optional[str] = None, backup: Optional[google.cloud.spanner_admin_database_v1.types.backup.Backup] = None, backup_id: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.operation.Operation[source]

Starts creating a new Cloud Spanner Backup. The returned backup [long-running operation][google.longrunning.Operation] will have a name of the format projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id> and can be used to track creation of the backup. The [metadata][google.longrunning.Operation.metadata] field type is [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. The [response][google.longrunning.Operation.response] field type is [Backup][google.spanner.admin.database.v1.Backup], if successful. Cancelling the returned operation will stop the creation and delete the backup. There can be only one pending backup creation per database. Backup creation of different databases can run concurrently.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

def sample_create_backup():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.CreateBackupRequest(
        parent="parent_value",
        backup_id="backup_id_value",
    )

    # Make the request
    operation = client.create_backup(request=request)

    print("Waiting for operation to complete...")

    response = operation.result()

    # Handle the response
    print(response)
Parameters
  • request (Union[google.cloud.spanner_admin_database_v1.types.CreateBackupRequest, dict]) – The request object. The request for [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup].

  • parent (str) –

    Required. The name of the instance in which the backup will be created. This must be the same instance that contains the database the backup will be created from. The backup will be stored in the location(s) specified in the instance configuration of this instance. Values are of the form projects/<project>/instances/<instance>.

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • backup (google.cloud.spanner_admin_database_v1.types.Backup) – Required. The backup to create. This corresponds to the backup field on the request instance; if request is provided, this should not be set.

  • backup_id (str) –

    Required. The id of the backup to be created. The backup_id appended to parent forms the full backup name of the form projects/<project>/instances/<instance>/backups/<backup_id>.

    This corresponds to the backup_id field on the request instance; if request 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]]) – Strings which should be sent along with the request as metadata.

Returns

An object representing a long-running operation.

The result type for the operation will be google.cloud.spanner_admin_database_v1.types.Backup A backup of a Cloud Spanner database.

Return type

google.api_core.operation.Operation

create_backup_schedule(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.backup_schedule.CreateBackupScheduleRequest, dict]] = None, *, parent: Optional[str] = None, backup_schedule: Optional[google.cloud.spanner_admin_database_v1.types.backup_schedule.BackupSchedule] = None, backup_schedule_id: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.spanner_admin_database_v1.types.backup_schedule.BackupSchedule[source]

Creates a new backup schedule.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

def sample_create_backup_schedule():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.CreateBackupScheduleRequest(
        parent="parent_value",
        backup_schedule_id="backup_schedule_id_value",
    )

    # Make the request
    response = client.create_backup_schedule(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.cloud.spanner_admin_database_v1.types.CreateBackupScheduleRequest, dict]) – The request object. The request for [CreateBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackupSchedule].

  • parent (str) –

    Required. The name of the database that this backup schedule applies to.

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • backup_schedule (google.cloud.spanner_admin_database_v1.types.BackupSchedule) –

    Required. The backup schedule to create.

    This corresponds to the backup_schedule field on the request instance; if request is provided, this should not be set.

  • backup_schedule_id (str) –

    Required. The Id to use for the backup schedule. The backup_schedule_id appended to parent forms the full backup schedule name of the form projects/<project>/instances/<instance>/databases/<database>/backupSchedules/<backup_schedule_id>.

    This corresponds to the backup_schedule_id field on the request instance; if request 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]]) – Strings which should be sent along with the request as metadata.

Returns

BackupSchedule expresses the automated backup creation specification for a Spanner database. Next ID: 10

Return type

google.cloud.spanner_admin_database_v1.types.BackupSchedule

create_database(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.CreateDatabaseRequest, dict]] = None, *, parent: Optional[str] = None, create_statement: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.operation.Operation[source]

Creates a new Cloud Spanner database and starts to prepare it for serving. The returned [long-running operation][google.longrunning.Operation] will have a name of the format <database_name>/operations/<operation_id> and can be used to track preparation of the database. The [metadata][google.longrunning.Operation.metadata] field type is [CreateDatabaseMetadata][google.spanner.admin.database.v1.CreateDatabaseMetadata]. The [response][google.longrunning.Operation.response] field type is [Database][google.spanner.admin.database.v1.Database], if successful.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

def sample_create_database():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.CreateDatabaseRequest(
        parent="parent_value",
        create_statement="create_statement_value",
    )

    # Make the request
    operation = client.create_database(request=request)

    print("Waiting for operation to complete...")

    response = operation.result()

    # Handle the response
    print(response)
Parameters
  • request (Union[google.cloud.spanner_admin_database_v1.types.CreateDatabaseRequest, dict]) – The request object. The request for [CreateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.CreateDatabase].

  • parent (str) –

    Required. The name of the instance that will serve the new database. Values are of the form projects/<project>/instances/<instance>.

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • create_statement (str) –

    Required. A CREATE DATABASE statement, which specifies the ID of the new database. The database ID must conform to the regular expression [a-z][a-z0-9_\-]*[a-z0-9] and be between 2 and 30 characters in length. If the database ID is a reserved word or if it contains a hyphen, the database ID must be enclosed in backticks (`).

    This corresponds to the create_statement field on the request instance; if request 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]]) – Strings which should be sent along with the request as metadata.

Returns

An object representing a long-running operation.

The result type for the operation will be google.cloud.spanner_admin_database_v1.types.Database A Cloud Spanner database.

Return type

google.api_core.operation.Operation

static crypto_key_path(project: str, location: str, key_ring: str, crypto_key: str) str[source]

Returns a fully-qualified crypto_key string.

static crypto_key_version_path(project: str, location: str, key_ring: str, crypto_key: str, crypto_key_version: str) str[source]

Returns a fully-qualified crypto_key_version string.

static database_path(project: str, instance: str, database: str) str[source]

Returns a fully-qualified database string.

static database_role_path(project: str, instance: str, database: str, role: str) str[source]

Returns a fully-qualified database_role string.

delete_backup(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.backup.DeleteBackupRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None[source]

Deletes a pending or completed [Backup][google.spanner.admin.database.v1.Backup].

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

def sample_delete_backup():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.DeleteBackupRequest(
        name="name_value",
    )

    # Make the request
    client.delete_backup(request=request)
Parameters
  • request (Union[google.cloud.spanner_admin_database_v1.types.DeleteBackupRequest, dict]) – The request object. The request for [DeleteBackup][google.spanner.admin.database.v1.DatabaseAdmin.DeleteBackup].

  • name (str) –

    Required. Name of the backup to delete. Values are of the form projects/<project>/instances/<instance>/backups/<backup>.

    This corresponds to the name field on the request instance; if request 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]]) – Strings which should be sent along with the request as metadata.

delete_backup_schedule(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.backup_schedule.DeleteBackupScheduleRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None[source]

Deletes a backup schedule.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

def sample_delete_backup_schedule():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.DeleteBackupScheduleRequest(
        name="name_value",
    )

    # Make the request
    client.delete_backup_schedule(request=request)
Parameters
  • request (Union[google.cloud.spanner_admin_database_v1.types.DeleteBackupScheduleRequest, dict]) – The request object. The request for [DeleteBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.DeleteBackupSchedule].

  • name (str) –

    Required. The name of the schedule to delete. Values are of the form projects/<project>/instances/<instance>/databases/<database>/backupSchedules/<backup_schedule_id>.

    This corresponds to the name field on the request instance; if request 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]]) – Strings which should be sent along with the request as metadata.

delete_operation(request: Optional[google.longrunning.operations_pb2.DeleteOperationRequest] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None[source]

Deletes a long-running operation.

This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn’t support this method, it returns google.rpc.Code.UNIMPLEMENTED.

Parameters
  • request (DeleteOperationRequest) – The request object. Request message for DeleteOperation method.

  • 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]]) – Strings which should be sent along with the request as metadata.

Returns

None

drop_database(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.DropDatabaseRequest, dict]] = None, *, database: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None[source]

Drops (aka deletes) a Cloud Spanner database. Completed backups for the database will be retained according to their expire_time. Note: Cloud Spanner might continue to accept requests for a few seconds after the database has been deleted.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

def sample_drop_database():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.DropDatabaseRequest(
        database="database_value",
    )

    # Make the request
    client.drop_database(request=request)
Parameters
  • request (Union[google.cloud.spanner_admin_database_v1.types.DropDatabaseRequest, dict]) – The request object. The request for [DropDatabase][google.spanner.admin.database.v1.DatabaseAdmin.DropDatabase].

  • database (str) – Required. The database to be dropped. This corresponds to the database field on the request instance; if request 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]]) – Strings which should be sent along with the request as metadata.

classmethod from_service_account_file(filename: str, *args, **kwargs)[source]
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

DatabaseAdminClient

classmethod from_service_account_info(info: dict, *args, **kwargs)[source]
Creates an instance of this client using the provided credentials

info.

Parameters
  • info (dict) – The service account private key info.

  • args – Additional arguments to pass to the constructor.

  • kwargs – Additional arguments to pass to the constructor.

Returns

The constructed client.

Return type

DatabaseAdminClient

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

DatabaseAdminClient

get_backup(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.backup.GetBackupRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.spanner_admin_database_v1.types.backup.Backup[source]

Gets metadata on a pending or completed [Backup][google.spanner.admin.database.v1.Backup].

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

def sample_get_backup():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.GetBackupRequest(
        name="name_value",
    )

    # Make the request
    response = client.get_backup(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.cloud.spanner_admin_database_v1.types.GetBackupRequest, dict]) – The request object. The request for [GetBackup][google.spanner.admin.database.v1.DatabaseAdmin.GetBackup].

  • name (str) –

    Required. Name of the backup. Values are of the form projects/<project>/instances/<instance>/backups/<backup>.

    This corresponds to the name field on the request instance; if request 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]]) – Strings which should be sent along with the request as metadata.

Returns

A backup of a Cloud Spanner database.

Return type

google.cloud.spanner_admin_database_v1.types.Backup

get_backup_schedule(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.backup_schedule.GetBackupScheduleRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.spanner_admin_database_v1.types.backup_schedule.BackupSchedule[source]

Gets backup schedule for the input schedule name.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

def sample_get_backup_schedule():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.GetBackupScheduleRequest(
        name="name_value",
    )

    # Make the request
    response = client.get_backup_schedule(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.cloud.spanner_admin_database_v1.types.GetBackupScheduleRequest, dict]) – The request object. The request for [GetBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.GetBackupSchedule].

  • name (str) –

    Required. The name of the schedule to retrieve. Values are of the form projects/<project>/instances/<instance>/databases/<database>/backupSchedules/<backup_schedule_id>.

    This corresponds to the name field on the request instance; if request 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]]) – Strings which should be sent along with the request as metadata.

Returns

BackupSchedule expresses the automated backup creation specification for a Spanner database. Next ID: 10

Return type

google.cloud.spanner_admin_database_v1.types.BackupSchedule

get_database(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.GetDatabaseRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.spanner_admin_database_v1.types.spanner_database_admin.Database[source]

Gets the state of a Cloud Spanner database.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

def sample_get_database():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.GetDatabaseRequest(
        name="name_value",
    )

    # Make the request
    response = client.get_database(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.cloud.spanner_admin_database_v1.types.GetDatabaseRequest, dict]) – The request object. The request for [GetDatabase][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabase].

  • name (str) –

    Required. The name of the requested database. Values are of the form projects/<project>/instances/<instance>/databases/<database>.

    This corresponds to the name field on the request instance; if request 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]]) – Strings which should be sent along with the request as metadata.

Returns

A Cloud Spanner database.

Return type

google.cloud.spanner_admin_database_v1.types.Database

get_database_ddl(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.GetDatabaseDdlRequest, dict]] = None, *, database: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.spanner_admin_database_v1.types.spanner_database_admin.GetDatabaseDdlResponse[source]

Returns the schema of a Cloud Spanner database as a list of formatted DDL statements. This method does not show pending schema updates, those may be queried using the [Operations][google.longrunning.Operations] API.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

def sample_get_database_ddl():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.GetDatabaseDdlRequest(
        database="database_value",
    )

    # Make the request
    response = client.get_database_ddl(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.cloud.spanner_admin_database_v1.types.GetDatabaseDdlRequest, dict]) – The request object. The request for [GetDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl].

  • database (str) –

    Required. The database whose schema we wish to get. Values are of the form projects/<project>/instances/<instance>/databases/<database>

    This corresponds to the database field on the request instance; if request 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]]) – Strings which should be sent along with the request as metadata.

Returns

The response for

[GetDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl].

Return type

google.cloud.spanner_admin_database_v1.types.GetDatabaseDdlResponse

get_iam_policy(request: Optional[Union[google.iam.v1.iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, resource: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.iam.v1.policy_pb2.Policy[source]

Gets the access control policy for a database or backup resource. Returns an empty policy if a database or backup exists but does not have a policy set.

Authorization requires spanner.databases.getIamPolicy permission on [resource][google.iam.v1.GetIamPolicyRequest.resource]. For backups, authorization requires spanner.backups.getIamPolicy permission on [resource][google.iam.v1.GetIamPolicyRequest.resource].

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1
from google.iam.v1 import iam_policy_pb2  # type: ignore

def sample_get_iam_policy():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminClient()

    # Initialize request argument(s)
    request = iam_policy_pb2.GetIamPolicyRequest(
        resource="resource_value",
    )

    # Make the request
    response = client.get_iam_policy(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.iam.v1.iam_policy_pb2.GetIamPolicyRequest, dict]) – 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 the resource field on the request instance; if request 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]]) – Strings which should be sent along with the request as metadata.

Returns

An Identity and Access Management (IAM) policy, which specifies access

controls for Google Cloud resources.

A Policy is a collection of bindings. A binding binds one or more members, or principals, to a single role. Principals can be user accounts, service accounts, Google groups, and domains (such as G Suite). A role is a named list of permissions; each role can be an IAM predefined role or a user-created custom role.

For some types of Google Cloud resources, a binding can also specify a condition, which is a logical expression that allows access to a resource only if the expression evaluates to true. A condition can add constraints based on attributes of the request, the resource, or both. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).

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')",           }         }       ],       "etag": "BwWWja0YfJA=",       "version": 3     }`

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')     etag: BwWWja0YfJA=     version: 3`

For a description of IAM and its features, see the [IAM documentation](https://cloud.google.com/iam/docs/).

Return type

google.iam.v1.policy_pb2.Policy

classmethod get_mtls_endpoint_and_cert_source(client_options: Optional[google.api_core.client_options.ClientOptions] = None)[source]

Deprecated. Return the API endpoint and client cert source for mutual TLS.

The client cert source is determined in the following order: (1) if GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is not “true”, the client cert source is None. (2) if client_options.client_cert_source is provided, use the provided one; if the default client cert source exists, use the default one; otherwise the client cert source is None.

The API endpoint is determined in the following order: (1) if client_options.api_endpoint if provided, use the provided one. (2) if GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is “always”, use the default mTLS endpoint; if the environment variable is “never”, use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint.

More details can be found at https://google.aip.dev/auth/4114.

Parameters

client_options (google.api_core.client_options.ClientOptions) – Custom options for the client. Only the api_endpoint and client_cert_source properties may be used in this method.

Returns

returns the API endpoint and the

client cert source to use.

Return type

Tuple[str, Callable[[], Tuple[bytes, bytes]]]

Raises

google.auth.exceptions.MutualTLSChannelError – If any errors happen.

get_operation(request: Optional[google.longrunning.operations_pb2.GetOperationRequest] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.longrunning.operations_pb2.Operation[source]

Gets the latest state of a long-running operation.

Parameters
  • request (GetOperationRequest) – The request object. Request message for GetOperation method.

  • 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]]) – Strings which should be sent along with the request as metadata.

Returns

An Operation object.

Return type

Operation

static instance_path(project: str, instance: str) str[source]

Returns a fully-qualified instance string.

list_backup_operations(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.backup.ListBackupOperationsRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListBackupOperationsPager[source]

Lists the backup [long-running operations][google.longrunning.Operation] in the given instance. A backup operation has a name of the form projects/<project>/instances/<instance>/backups/<backup>/operations/<operation>. The long-running operation [metadata][google.longrunning.Operation.metadata] field type metadata.type_url describes the type of the metadata. Operations returned include those that have completed/failed/canceled within the last 7 days, and pending operations. Operations returned are ordered by operation.metadata.value.progress.start_time in descending order starting from the most recently started operation.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

def sample_list_backup_operations():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.ListBackupOperationsRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_backup_operations(request=request)

    # Handle the response
    for response in page_result:
        print(response)
Parameters
  • request (Union[google.cloud.spanner_admin_database_v1.types.ListBackupOperationsRequest, dict]) – The request object. The request for [ListBackupOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations].

  • parent (str) –

    Required. The instance of the backup operations. Values are of the form projects/<project>/instances/<instance>.

    This corresponds to the parent field on the request instance; if request 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]]) – Strings which should be sent along with the request as metadata.

Returns

The response for

[ListBackupOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations].

Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListBackupOperationsPager

list_backup_schedules(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.backup_schedule.ListBackupSchedulesRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListBackupSchedulesPager[source]

Lists all the backup schedules for the database.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

def sample_list_backup_schedules():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.ListBackupSchedulesRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_backup_schedules(request=request)

    # Handle the response
    for response in page_result:
        print(response)
Parameters
  • request (Union[google.cloud.spanner_admin_database_v1.types.ListBackupSchedulesRequest, dict]) – The request object. The request for [ListBackupSchedules][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules].

  • parent (str) –

    Required. Database is the parent resource whose backup schedules should be listed. Values are of the form projects/<project>/instances/<instance>/databases/<database>

    This corresponds to the parent field on the request instance; if request 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]]) – Strings which should be sent along with the request as metadata.

Returns

The response for

[ListBackupSchedules][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules].

Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListBackupSchedulesPager

list_backups(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.backup.ListBackupsRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListBackupsPager[source]

Lists completed and pending backups. Backups returned are ordered by create_time in descending order, starting from the most recent create_time.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

def sample_list_backups():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.ListBackupsRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_backups(request=request)

    # Handle the response
    for response in page_result:
        print(response)
Parameters
  • request (Union[google.cloud.spanner_admin_database_v1.types.ListBackupsRequest, dict]) – The request object. The request for [ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups].

  • parent (str) –

    Required. The instance to list backups from. Values are of the form projects/<project>/instances/<instance>.

    This corresponds to the parent field on the request instance; if request 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]]) – Strings which should be sent along with the request as metadata.

Returns

The response for

[ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups].

Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListBackupsPager

list_database_operations(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.ListDatabaseOperationsRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListDatabaseOperationsPager[source]

Lists database [longrunning-operations][google.longrunning.Operation]. A database operation has a name of the form projects/<project>/instances/<instance>/databases/<database>/operations/<operation>. The long-running operation [metadata][google.longrunning.Operation.metadata] field type metadata.type_url describes the type of the metadata. Operations returned include those that have completed/failed/canceled within the last 7 days, and pending operations.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

def sample_list_database_operations():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.ListDatabaseOperationsRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_database_operations(request=request)

    # Handle the response
    for response in page_result:
        print(response)
Parameters
  • request (Union[google.cloud.spanner_admin_database_v1.types.ListDatabaseOperationsRequest, dict]) – The request object. The request for [ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations].

  • parent (str) –

    Required. The instance of the database operations. Values are of the form projects/<project>/instances/<instance>.

    This corresponds to the parent field on the request instance; if request 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]]) – Strings which should be sent along with the request as metadata.

Returns

The response for

[ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations].

Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListDatabaseOperationsPager

list_database_roles(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.ListDatabaseRolesRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListDatabaseRolesPager[source]

Lists Cloud Spanner database roles.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

def sample_list_database_roles():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.ListDatabaseRolesRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_database_roles(request=request)

    # Handle the response
    for response in page_result:
        print(response)
Parameters
  • request (Union[google.cloud.spanner_admin_database_v1.types.ListDatabaseRolesRequest, dict]) – The request object. The request for [ListDatabaseRoles][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles].

  • parent (str) –

    Required. The database whose roles should be listed. Values are of the form projects/<project>/instances/<instance>/databases/<database>.

    This corresponds to the parent field on the request instance; if request 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]]) – Strings which should be sent along with the request as metadata.

Returns

The response for

[ListDatabaseRoles][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles].

Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListDatabaseRolesPager

list_databases(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.ListDatabasesRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListDatabasesPager[source]

Lists Cloud Spanner databases.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

def sample_list_databases():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.ListDatabasesRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_databases(request=request)

    # Handle the response
    for response in page_result:
        print(response)
Parameters
  • request (Union[google.cloud.spanner_admin_database_v1.types.ListDatabasesRequest, dict]) – The request object. The request for [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases].

  • parent (str) –

    Required. The instance whose databases should be listed. Values are of the form projects/<project>/instances/<instance>.

    This corresponds to the parent field on the request instance; if request 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]]) – Strings which should be sent along with the request as metadata.

Returns

The response for

[ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases].

Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListDatabasesPager

list_operations(request: Optional[google.longrunning.operations_pb2.ListOperationsRequest] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.longrunning.operations_pb2.ListOperationsResponse[source]

Lists operations that match the specified filter in the request.

Parameters
  • request (ListOperationsRequest) – The request object. Request message for ListOperations method.

  • 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]]) – Strings which should be sent along with the request as metadata.

Returns

Response message for ListOperations method.

Return type

ListOperationsResponse

static parse_backup_path(path: str) Dict[str, str][source]

Parses a backup path into its component segments.

static parse_backup_schedule_path(path: str) Dict[str, str][source]

Parses a backup_schedule path into its component segments.

static parse_common_billing_account_path(path: str) Dict[str, str][source]

Parse a billing_account path into its component segments.

static parse_common_folder_path(path: str) Dict[str, str][source]

Parse a folder path into its component segments.

static parse_common_location_path(path: str) Dict[str, str][source]

Parse a location path into its component segments.

static parse_common_organization_path(path: str) Dict[str, str][source]

Parse a organization path into its component segments.

static parse_common_project_path(path: str) Dict[str, str][source]

Parse a project path into its component segments.

static parse_crypto_key_path(path: str) Dict[str, str][source]

Parses a crypto_key path into its component segments.

static parse_crypto_key_version_path(path: str) Dict[str, str][source]

Parses a crypto_key_version path into its component segments.

static parse_database_path(path: str) Dict[str, str][source]

Parses a database path into its component segments.

static parse_database_role_path(path: str) Dict[str, str][source]

Parses a database_role path into its component segments.

static parse_instance_path(path: str) Dict[str, str][source]

Parses a instance path into its component segments.

restore_database(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.RestoreDatabaseRequest, dict]] = None, *, parent: Optional[str] = None, database_id: Optional[str] = None, backup: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.operation.Operation[source]

Create a new database by restoring from a completed backup. The new database must be in the same project and in an instance with the same instance configuration as the instance containing the backup. The returned database [long-running operation][google.longrunning.Operation] has a name of the format projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>, and can be used to track the progress of the operation, and to cancel it. The [metadata][google.longrunning.Operation.metadata] field type is [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]. The [response][google.longrunning.Operation.response] type is [Database][google.spanner.admin.database.v1.Database], if successful. Cancelling the returned operation will stop the restore and delete the database. There can be only one database being restored into an instance at a time. Once the restore operation completes, a new restore operation can be initiated, without waiting for the optimize operation associated with the first restore to complete.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

def sample_restore_database():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.RestoreDatabaseRequest(
        backup="backup_value",
        parent="parent_value",
        database_id="database_id_value",
    )

    # Make the request
    operation = client.restore_database(request=request)

    print("Waiting for operation to complete...")

    response = operation.result()

    # Handle the response
    print(response)
Parameters
  • request (Union[google.cloud.spanner_admin_database_v1.types.RestoreDatabaseRequest, dict]) – The request object. The request for [RestoreDatabase][google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase].

  • parent (str) –

    Required. The name of the instance in which to create the restored database. This instance must be in the same project and have the same instance configuration as the instance containing the source backup. Values are of the form projects/<project>/instances/<instance>.

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • database_id (str) –

    Required. The id of the database to create and restore to. This database must not already exist. The database_id appended to parent forms the full database name of the form projects/<project>/instances/<instance>/databases/<database_id>.

    This corresponds to the database_id field on the request instance; if request is provided, this should not be set.

  • backup (str) –

    Name of the backup from which to restore. Values are of the form projects/<project>/instances/<instance>/backups/<backup>.

    This corresponds to the backup field on the request instance; if request 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]]) – Strings which should be sent along with the request as metadata.

Returns

An object representing a long-running operation.

The result type for the operation will be google.cloud.spanner_admin_database_v1.types.Database A Cloud Spanner database.

Return type

google.api_core.operation.Operation

set_iam_policy(request: Optional[Union[google.iam.v1.iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, resource: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.iam.v1.policy_pb2.Policy[source]

Sets the access control policy on a database or backup resource. Replaces any existing policy.

Authorization requires spanner.databases.setIamPolicy permission on [resource][google.iam.v1.SetIamPolicyRequest.resource]. For backups, authorization requires spanner.backups.setIamPolicy permission on [resource][google.iam.v1.SetIamPolicyRequest.resource].

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1
from google.iam.v1 import iam_policy_pb2  # type: ignore

def sample_set_iam_policy():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminClient()

    # Initialize request argument(s)
    request = iam_policy_pb2.SetIamPolicyRequest(
        resource="resource_value",
    )

    # Make the request
    response = client.set_iam_policy(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.iam.v1.iam_policy_pb2.SetIamPolicyRequest, dict]) – 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 the resource field on the request instance; if request 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]]) – Strings which should be sent along with the request as metadata.

Returns

An Identity and Access Management (IAM) policy, which specifies access

controls for Google Cloud resources.

A Policy is a collection of bindings. A binding binds one or more members, or principals, to a single role. Principals can be user accounts, service accounts, Google groups, and domains (such as G Suite). A role is a named list of permissions; each role can be an IAM predefined role or a user-created custom role.

For some types of Google Cloud resources, a binding can also specify a condition, which is a logical expression that allows access to a resource only if the expression evaluates to true. A condition can add constraints based on attributes of the request, the resource, or both. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).

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')",           }         }       ],       "etag": "BwWWja0YfJA=",       "version": 3     }`

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')     etag: BwWWja0YfJA=     version: 3`

For a description of IAM and its features, see the [IAM documentation](https://cloud.google.com/iam/docs/).

Return type

google.iam.v1.policy_pb2.Policy

test_iam_permissions(request: Optional[Union[google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, resource: Optional[str] = None, permissions: Optional[MutableSequence[str]] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.iam.v1.iam_policy_pb2.TestIamPermissionsResponse[source]

Returns permissions that the caller has on the specified database or backup resource.

Attempting this RPC on a non-existent Cloud Spanner database will result in a NOT_FOUND error if the user has spanner.databases.list permission on the containing Cloud Spanner instance. Otherwise returns an empty set of permissions. Calling this method on a backup that does not exist will result in a NOT_FOUND error if the user has spanner.backups.list permission on the containing instance.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1
from google.iam.v1 import iam_policy_pb2  # type: ignore

def sample_test_iam_permissions():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminClient()

    # Initialize request argument(s)
    request = iam_policy_pb2.TestIamPermissionsRequest(
        resource="resource_value",
        permissions=['permissions_value1', 'permissions_value2'],
    )

    # Make the request
    response = client.test_iam_permissions(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest, dict]) – 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 the resource field on the request instance; if request is provided, this should not be set.

  • permissions (MutableSequence[str]) –

    The set of permissions to check for the resource. Permissions with wildcards (such as ‘*’ or ‘storage.*’) are not allowed. For more information see IAM Overview.

    This corresponds to the permissions field on the request instance; if request 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]]) – Strings which should be sent along with the request as metadata.

Returns

Response message for TestIamPermissions method.

Return type

google.iam.v1.iam_policy_pb2.TestIamPermissionsResponse

property transport: google.cloud.spanner_admin_database_v1.services.database_admin.transports.base.DatabaseAdminTransport

Returns the transport used by the client instance.

Returns

The transport used by the client

instance.

Return type

DatabaseAdminTransport

property universe_domain: str

Return the universe domain used by the client instance.

Returns

The universe domain used by the client instance.

Return type

str

update_backup(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.backup.UpdateBackupRequest, dict]] = None, *, backup: Optional[google.cloud.spanner_admin_database_v1.types.backup.Backup] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.spanner_admin_database_v1.types.backup.Backup[source]

Updates a pending or completed [Backup][google.spanner.admin.database.v1.Backup].

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

def sample_update_backup():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.UpdateBackupRequest(
    )

    # Make the request
    response = client.update_backup(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.cloud.spanner_admin_database_v1.types.UpdateBackupRequest, dict]) – The request object. The request for [UpdateBackup][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackup].

  • backup (google.cloud.spanner_admin_database_v1.types.Backup) –

    Required. The backup to update. backup.name, and the fields to be updated as specified by update_mask are required. Other fields are ignored. Update is only supported for the following fields:

    • backup.expire_time.

    This corresponds to the backup field on the request instance; if request is provided, this should not be set.

  • update_mask (google.protobuf.field_mask_pb2.FieldMask) –

    Required. A mask specifying which fields (e.g. expire_time) in the Backup resource should be updated. This mask is relative to the Backup resource, not to the request message. The field mask must always be specified; this prevents any future fields from being erased accidentally by clients that do not know about them.

    This corresponds to the update_mask field on the request instance; if request 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]]) – Strings which should be sent along with the request as metadata.

Returns

A backup of a Cloud Spanner database.

Return type

google.cloud.spanner_admin_database_v1.types.Backup

update_backup_schedule(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.backup_schedule.UpdateBackupScheduleRequest, dict]] = None, *, backup_schedule: Optional[google.cloud.spanner_admin_database_v1.types.backup_schedule.BackupSchedule] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.spanner_admin_database_v1.types.backup_schedule.BackupSchedule[source]

Updates a backup schedule.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

def sample_update_backup_schedule():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.UpdateBackupScheduleRequest(
    )

    # Make the request
    response = client.update_backup_schedule(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.cloud.spanner_admin_database_v1.types.UpdateBackupScheduleRequest, dict]) – The request object. The request for [UpdateBackupScheduleRequest][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackupSchedule].

  • backup_schedule (google.cloud.spanner_admin_database_v1.types.BackupSchedule) –

    Required. The backup schedule to update. backup_schedule.name, and the fields to be updated as specified by update_mask are required. Other fields are ignored.

    This corresponds to the backup_schedule field on the request instance; if request is provided, this should not be set.

  • update_mask (google.protobuf.field_mask_pb2.FieldMask) –

    Required. A mask specifying which fields in the BackupSchedule resource should be updated. This mask is relative to the BackupSchedule resource, not to the request message. The field mask must always be specified; this prevents any future fields from being erased accidentally.

    This corresponds to the update_mask field on the request instance; if request 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]]) – Strings which should be sent along with the request as metadata.

Returns

BackupSchedule expresses the automated backup creation specification for a Spanner database. Next ID: 10

Return type

google.cloud.spanner_admin_database_v1.types.BackupSchedule

update_database(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.UpdateDatabaseRequest, dict]] = None, *, database: Optional[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.Database] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.operation.Operation[source]

Updates a Cloud Spanner database. The returned [long-running operation][google.longrunning.Operation] can be used to track the progress of updating the database. If the named database does not exist, returns NOT_FOUND.

While the operation is pending:

  • The database’s [reconciling][google.spanner.admin.database.v1.Database.reconciling] field is set to true.

  • Cancelling the operation is best-effort. If the cancellation succeeds, the operation metadata’s [cancel_time][google.spanner.admin.database.v1.UpdateDatabaseMetadata.cancel_time] is set, the updates are reverted, and the operation terminates with a CANCELLED status.

  • New UpdateDatabase requests will return a FAILED_PRECONDITION error until the pending operation is done (returns successfully or with error).

  • Reading the database via the API continues to give the pre-request values.

Upon completion of the returned operation:

  • The new values are in effect and readable via the API.

  • The database’s [reconciling][google.spanner.admin.database.v1.Database.reconciling] field becomes false.

The returned [long-running operation][google.longrunning.Operation] will have a name of the format projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id> and can be used to track the database modification. The [metadata][google.longrunning.Operation.metadata] field type is [UpdateDatabaseMetadata][google.spanner.admin.database.v1.UpdateDatabaseMetadata]. The [response][google.longrunning.Operation.response] field type is [Database][google.spanner.admin.database.v1.Database], if successful.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

def sample_update_database():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminClient()

    # Initialize request argument(s)
    database = spanner_admin_database_v1.Database()
    database.name = "name_value"

    request = spanner_admin_database_v1.UpdateDatabaseRequest(
        database=database,
    )

    # Make the request
    operation = client.update_database(request=request)

    print("Waiting for operation to complete...")

    response = operation.result()

    # Handle the response
    print(response)
Parameters
  • request (Union[google.cloud.spanner_admin_database_v1.types.UpdateDatabaseRequest, dict]) – The request object. The request for [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase].

  • database (google.cloud.spanner_admin_database_v1.types.Database) –

    Required. The database to update. The name field of the database is of the form projects/<project>/instances/<instance>/databases/<database>.

    This corresponds to the database field on the request instance; if request is provided, this should not be set.

  • update_mask (google.protobuf.field_mask_pb2.FieldMask) –

    Required. The list of fields to update. Currently, only enable_drop_protection field can be updated.

    This corresponds to the update_mask field on the request instance; if request 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]]) – Strings which should be sent along with the request as metadata.

Returns

An object representing a long-running operation.

The result type for the operation will be google.cloud.spanner_admin_database_v1.types.Database A Cloud Spanner database.

Return type

google.api_core.operation.Operation

update_database_ddl(request: Optional[Union[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.UpdateDatabaseDdlRequest, dict]] = None, *, database: Optional[str] = None, statements: Optional[MutableSequence[str]] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.operation.Operation[source]

Updates the schema of a Cloud Spanner database by creating/altering/dropping tables, columns, indexes, etc. The returned [long-running operation][google.longrunning.Operation] will have a name of the format <database_name>/operations/<operation_id> and can be used to track execution of the schema change(s). The [metadata][google.longrunning.Operation.metadata] field type is [UpdateDatabaseDdlMetadata][google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata]. The operation has no response.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import spanner_admin_database_v1

def sample_update_database_ddl():
    # Create a client
    client = spanner_admin_database_v1.DatabaseAdminClient()

    # Initialize request argument(s)
    request = spanner_admin_database_v1.UpdateDatabaseDdlRequest(
        database="database_value",
        statements=['statements_value1', 'statements_value2'],
    )

    # Make the request
    operation = client.update_database_ddl(request=request)

    print("Waiting for operation to complete...")

    response = operation.result()

    # Handle the response
    print(response)
Parameters
  • request (Union[google.cloud.spanner_admin_database_v1.types.UpdateDatabaseDdlRequest, dict]) –

    The request object. Enqueues the given DDL statements to be applied, in order but not necessarily all at once, to the database schema at some point (or points) in the future. The server checks that the statements are executable (syntactically valid, name tables that exist, etc.) before enqueueing them, but they may still fail upon later execution (e.g., if a statement from another batch of statements is applied first and it conflicts in some way, or if there is some data-related problem like a NULL value in a column to which NOT NULL would be added). If a statement fails, all subsequent statements in the batch are automatically cancelled.

    Each batch of statements is assigned a name which can be used with the [Operations][google.longrunning.Operations] API to monitor progress. See the [operation_id][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.operation_id] field for more details.

  • database (str) – Required. The database to update. This corresponds to the database field on the request instance; if request is provided, this should not be set.

  • statements (MutableSequence[str]) –

    Required. DDL statements to be applied to the database.

    This corresponds to the statements field on the request instance; if request 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]]) – Strings which should be sent along with the request as metadata.

Returns

An object representing a long-running operation.

The result type for the operation will be google.protobuf.empty_pb2.Empty A generic empty message that you can re-use to avoid defining duplicated

empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance:

service Foo {

rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);

}

Return type

google.api_core.operation.Operation

class google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListBackupOperationsAsyncPager(method: Callable[[...], Awaitable[google.cloud.spanner_admin_database_v1.types.backup.ListBackupOperationsResponse]], request: google.cloud.spanner_admin_database_v1.types.backup.ListBackupOperationsRequest, response: google.cloud.spanner_admin_database_v1.types.backup.ListBackupOperationsResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]

A pager for iterating through list_backup_operations requests.

This class thinly wraps an initial google.cloud.spanner_admin_database_v1.types.ListBackupOperationsResponse object, and provides an __aiter__ method to iterate through its operations field.

If there are more pages, the __aiter__ method will make additional ListBackupOperations requests and continue to iterate through the operations field on the corresponding responses.

All the usual google.cloud.spanner_admin_database_v1.types.ListBackupOperationsResponse attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.

Instantiates the pager.

Parameters
class google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListBackupOperationsPager(method: Callable[[...], google.cloud.spanner_admin_database_v1.types.backup.ListBackupOperationsResponse], request: google.cloud.spanner_admin_database_v1.types.backup.ListBackupOperationsRequest, response: google.cloud.spanner_admin_database_v1.types.backup.ListBackupOperationsResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]

A pager for iterating through list_backup_operations requests.

This class thinly wraps an initial google.cloud.spanner_admin_database_v1.types.ListBackupOperationsResponse object, and provides an __iter__ method to iterate through its operations field.

If there are more pages, the __iter__ method will make additional ListBackupOperations requests and continue to iterate through the operations field on the corresponding responses.

All the usual google.cloud.spanner_admin_database_v1.types.ListBackupOperationsResponse attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.

Instantiate the pager.

Parameters
class google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListBackupSchedulesAsyncPager(method: Callable[[...], Awaitable[google.cloud.spanner_admin_database_v1.types.backup_schedule.ListBackupSchedulesResponse]], request: google.cloud.spanner_admin_database_v1.types.backup_schedule.ListBackupSchedulesRequest, response: google.cloud.spanner_admin_database_v1.types.backup_schedule.ListBackupSchedulesResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]

A pager for iterating through list_backup_schedules requests.

This class thinly wraps an initial google.cloud.spanner_admin_database_v1.types.ListBackupSchedulesResponse object, and provides an __aiter__ method to iterate through its backup_schedules field.

If there are more pages, the __aiter__ method will make additional ListBackupSchedules requests and continue to iterate through the backup_schedules field on the corresponding responses.

All the usual google.cloud.spanner_admin_database_v1.types.ListBackupSchedulesResponse attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.

Instantiates the pager.

Parameters
class google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListBackupSchedulesPager(method: Callable[[...], google.cloud.spanner_admin_database_v1.types.backup_schedule.ListBackupSchedulesResponse], request: google.cloud.spanner_admin_database_v1.types.backup_schedule.ListBackupSchedulesRequest, response: google.cloud.spanner_admin_database_v1.types.backup_schedule.ListBackupSchedulesResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]

A pager for iterating through list_backup_schedules requests.

This class thinly wraps an initial google.cloud.spanner_admin_database_v1.types.ListBackupSchedulesResponse object, and provides an __iter__ method to iterate through its backup_schedules field.

If there are more pages, the __iter__ method will make additional ListBackupSchedules requests and continue to iterate through the backup_schedules field on the corresponding responses.

All the usual google.cloud.spanner_admin_database_v1.types.ListBackupSchedulesResponse attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.

Instantiate the pager.

Parameters
class google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListBackupsAsyncPager(method: Callable[[...], Awaitable[google.cloud.spanner_admin_database_v1.types.backup.ListBackupsResponse]], request: google.cloud.spanner_admin_database_v1.types.backup.ListBackupsRequest, response: google.cloud.spanner_admin_database_v1.types.backup.ListBackupsResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]

A pager for iterating through list_backups requests.

This class thinly wraps an initial google.cloud.spanner_admin_database_v1.types.ListBackupsResponse object, and provides an __aiter__ method to iterate through its backups field.

If there are more pages, the __aiter__ method will make additional ListBackups requests and continue to iterate through the backups field on the corresponding responses.

All the usual google.cloud.spanner_admin_database_v1.types.ListBackupsResponse attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.

Instantiates the pager.

Parameters
class google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListBackupsPager(method: Callable[[...], google.cloud.spanner_admin_database_v1.types.backup.ListBackupsResponse], request: google.cloud.spanner_admin_database_v1.types.backup.ListBackupsRequest, response: google.cloud.spanner_admin_database_v1.types.backup.ListBackupsResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]

A pager for iterating through list_backups requests.

This class thinly wraps an initial google.cloud.spanner_admin_database_v1.types.ListBackupsResponse object, and provides an __iter__ method to iterate through its backups field.

If there are more pages, the __iter__ method will make additional ListBackups requests and continue to iterate through the backups field on the corresponding responses.

All the usual google.cloud.spanner_admin_database_v1.types.ListBackupsResponse attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.

Instantiate the pager.

Parameters
class google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListDatabaseOperationsAsyncPager(method: Callable[[...], Awaitable[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.ListDatabaseOperationsResponse]], request: google.cloud.spanner_admin_database_v1.types.spanner_database_admin.ListDatabaseOperationsRequest, response: google.cloud.spanner_admin_database_v1.types.spanner_database_admin.ListDatabaseOperationsResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]

A pager for iterating through list_database_operations requests.

This class thinly wraps an initial google.cloud.spanner_admin_database_v1.types.ListDatabaseOperationsResponse object, and provides an __aiter__ method to iterate through its operations field.

If there are more pages, the __aiter__ method will make additional ListDatabaseOperations requests and continue to iterate through the operations field on the corresponding responses.

All the usual google.cloud.spanner_admin_database_v1.types.ListDatabaseOperationsResponse attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.

Instantiates the pager.

Parameters
class google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListDatabaseOperationsPager(method: Callable[[...], google.cloud.spanner_admin_database_v1.types.spanner_database_admin.ListDatabaseOperationsResponse], request: google.cloud.spanner_admin_database_v1.types.spanner_database_admin.ListDatabaseOperationsRequest, response: google.cloud.spanner_admin_database_v1.types.spanner_database_admin.ListDatabaseOperationsResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]

A pager for iterating through list_database_operations requests.

This class thinly wraps an initial google.cloud.spanner_admin_database_v1.types.ListDatabaseOperationsResponse object, and provides an __iter__ method to iterate through its operations field.

If there are more pages, the __iter__ method will make additional ListDatabaseOperations requests and continue to iterate through the operations field on the corresponding responses.

All the usual google.cloud.spanner_admin_database_v1.types.ListDatabaseOperationsResponse attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.

Instantiate the pager.

Parameters
class google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListDatabaseRolesAsyncPager(method: Callable[[...], Awaitable[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.ListDatabaseRolesResponse]], request: google.cloud.spanner_admin_database_v1.types.spanner_database_admin.ListDatabaseRolesRequest, response: google.cloud.spanner_admin_database_v1.types.spanner_database_admin.ListDatabaseRolesResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]

A pager for iterating through list_database_roles requests.

This class thinly wraps an initial google.cloud.spanner_admin_database_v1.types.ListDatabaseRolesResponse object, and provides an __aiter__ method to iterate through its database_roles field.

If there are more pages, the __aiter__ method will make additional ListDatabaseRoles requests and continue to iterate through the database_roles field on the corresponding responses.

All the usual google.cloud.spanner_admin_database_v1.types.ListDatabaseRolesResponse attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.

Instantiates the pager.

Parameters
class google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListDatabaseRolesPager(method: Callable[[...], google.cloud.spanner_admin_database_v1.types.spanner_database_admin.ListDatabaseRolesResponse], request: google.cloud.spanner_admin_database_v1.types.spanner_database_admin.ListDatabaseRolesRequest, response: google.cloud.spanner_admin_database_v1.types.spanner_database_admin.ListDatabaseRolesResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]

A pager for iterating through list_database_roles requests.

This class thinly wraps an initial google.cloud.spanner_admin_database_v1.types.ListDatabaseRolesResponse object, and provides an __iter__ method to iterate through its database_roles field.

If there are more pages, the __iter__ method will make additional ListDatabaseRoles requests and continue to iterate through the database_roles field on the corresponding responses.

All the usual google.cloud.spanner_admin_database_v1.types.ListDatabaseRolesResponse attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.

Instantiate the pager.

Parameters
class google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListDatabasesAsyncPager(method: Callable[[...], Awaitable[google.cloud.spanner_admin_database_v1.types.spanner_database_admin.ListDatabasesResponse]], request: google.cloud.spanner_admin_database_v1.types.spanner_database_admin.ListDatabasesRequest, response: google.cloud.spanner_admin_database_v1.types.spanner_database_admin.ListDatabasesResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]

A pager for iterating through list_databases requests.

This class thinly wraps an initial google.cloud.spanner_admin_database_v1.types.ListDatabasesResponse object, and provides an __aiter__ method to iterate through its databases field.

If there are more pages, the __aiter__ method will make additional ListDatabases requests and continue to iterate through the databases field on the corresponding responses.

All the usual google.cloud.spanner_admin_database_v1.types.ListDatabasesResponse attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.

Instantiates the pager.

Parameters
class google.cloud.spanner_admin_database_v1.services.database_admin.pagers.ListDatabasesPager(method: Callable[[...], google.cloud.spanner_admin_database_v1.types.spanner_database_admin.ListDatabasesResponse], request: google.cloud.spanner_admin_database_v1.types.spanner_database_admin.ListDatabasesRequest, response: google.cloud.spanner_admin_database_v1.types.spanner_database_admin.ListDatabasesResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]

A pager for iterating through list_databases requests.

This class thinly wraps an initial google.cloud.spanner_admin_database_v1.types.ListDatabasesResponse object, and provides an __iter__ method to iterate through its databases field.

If there are more pages, the __iter__ method will make additional ListDatabases requests and continue to iterate through the databases field on the corresponding responses.

All the usual google.cloud.spanner_admin_database_v1.types.ListDatabasesResponse attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.

Instantiate the pager.

Parameters