Skip to content

Commit

Permalink
feat: add DdlStatementActionInfo and add actions to UpdateDatabaseDdl…
Browse files Browse the repository at this point in the history
…Metadata (#948)

* feat(spanner): add DdlStatementActionInfo and add actions to UpdateDatabaseDdlMetadata

PiperOrigin-RevId: 536483675

Source-Link: googleapis/googleapis@9b1c253

Source-Link: googleapis/googleapis-gen@b901406
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjkwMTQwNjQ1ZDRlMWNmYTdiNTZmNjA4M2E0M2NmZGQ4NzI1NThiYSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] committed May 31, 2023
1 parent 9ce1cea commit 1ca6874
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 11 deletions.
2 changes: 2 additions & 0 deletions google/cloud/spanner_admin_database_v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
from .types.spanner_database_admin import CreateDatabaseRequest
from .types.spanner_database_admin import Database
from .types.spanner_database_admin import DatabaseRole
from .types.spanner_database_admin import DdlStatementActionInfo
from .types.spanner_database_admin import DropDatabaseRequest
from .types.spanner_database_admin import GetDatabaseDdlRequest
from .types.spanner_database_admin import GetDatabaseDdlResponse
Expand Down Expand Up @@ -81,6 +82,7 @@
"DatabaseAdminClient",
"DatabaseDialect",
"DatabaseRole",
"DdlStatementActionInfo",
"DeleteBackupRequest",
"DropDatabaseRequest",
"EncryptionConfig",
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/spanner_admin_database_v1/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
CreateDatabaseRequest,
Database,
DatabaseRole,
DdlStatementActionInfo,
DropDatabaseRequest,
GetDatabaseDdlRequest,
GetDatabaseDdlResponse,
Expand Down Expand Up @@ -87,6 +88,7 @@
"CreateDatabaseRequest",
"Database",
"DatabaseRole",
"DdlStatementActionInfo",
"DropDatabaseRequest",
"GetDatabaseDdlRequest",
"GetDatabaseDdlResponse",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"UpdateDatabaseRequest",
"UpdateDatabaseMetadata",
"UpdateDatabaseDdlRequest",
"DdlStatementActionInfo",
"UpdateDatabaseDdlMetadata",
"DropDatabaseRequest",
"GetDatabaseDdlRequest",
Expand Down Expand Up @@ -533,6 +534,46 @@ class UpdateDatabaseDdlRequest(proto.Message):
)


class DdlStatementActionInfo(proto.Message):
r"""Action information extracted from a DDL statement. This proto is
used to display the brief info of the DDL statement for the
operation
[UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl].
Attributes:
action (str):
The action for the DDL statement, e.g.
CREATE, ALTER, DROP, GRANT, etc. This field is a
non-empty string.
entity_type (str):
The entity type for the DDL statement, e.g. TABLE, INDEX,
VIEW, etc. This field can be empty string for some DDL
statement, e.g. for statement "ANALYZE", ``entity_type`` =
"".
entity_names (MutableSequence[str]):
The entity name(s) being operated on the DDL statement. E.g.
1. For statement "CREATE TABLE t1(...)", ``entity_names`` =
["t1"].
2. For statement "GRANT ROLE r1, r2 ...", ``entity_names`` =
["r1", "r2"].
3. For statement "ANALYZE", ``entity_names`` = [].
"""

action: str = proto.Field(
proto.STRING,
number=1,
)
entity_type: str = proto.Field(
proto.STRING,
number=2,
)
entity_names: MutableSequence[str] = proto.RepeatedField(
proto.STRING,
number=3,
)


class UpdateDatabaseDdlMetadata(proto.Message):
r"""Metadata type for the operation returned by
[UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl].
Expand All @@ -550,20 +591,22 @@ class UpdateDatabaseDdlMetadata(proto.Message):
commit timestamp for the statement ``statements[i]``.
throttled (bool):
Output only. When true, indicates that the
operation is throttled e.g due to resource
operation is throttled e.g. due to resource
constraints. When resources become available the
operation will resume and this field will be
false again.
progress (MutableSequence[google.cloud.spanner_admin_database_v1.types.OperationProgress]):
The progress of the
[UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]
operations. Currently, only index creation statements will
have a continuously updating progress. For non-index
creation statements, ``progress[i]`` will have start time
and end time populated with commit timestamp of operation,
as well as a progress of 100% once the operation has
completed. ``progress[i]`` is the operation progress for
``statements[i]``.
operations. All DDL statements will have continuously
updating progress, and ``progress[i]`` is the operation
progress for ``statements[i]``. Also, ``progress[i]`` will
have start time and end time populated with commit timestamp
of operation, as well as a progress of 100% once the
operation has completed.
actions (MutableSequence[google.cloud.spanner_admin_database_v1.types.DdlStatementActionInfo]):
The brief action info for the DDL statements. ``actions[i]``
is the brief info for ``statements[i]``.
"""

database: str = proto.Field(
Expand All @@ -588,6 +631,11 @@ class UpdateDatabaseDdlMetadata(proto.Message):
number=5,
message=common.OperationProgress,
)
actions: MutableSequence["DdlStatementActionInfo"] = proto.RepeatedField(
proto.MESSAGE,
number=6,
message="DdlStatementActionInfo",
)


class DropDatabaseRequest(proto.Message):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-spanner-admin-database",
"version": "3.35.1"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-spanner-admin-instance",
"version": "3.35.1"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-spanner",
"version": "3.35.1"
"version": "0.1.0"
},
"snippets": [
{
Expand Down

0 comments on commit 1ca6874

Please sign in to comment.