Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: add DdlStatementActionInfo and add actions to UpdateDatabaseDdlMetadata #948

Merged
merged 2 commits into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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