databases_ddl
Creates, updates, deletes, gets or lists a databases_ddl
resource.
Overview
Name | databases_ddl |
Type | Resource |
Id | google.spanner.databases_ddl |
Fields
The following fields are returned by SELECT
queries:
- projects_instances_databases_get_ddl
Successful response
Name | Datatype | Description |
---|---|---|
protoDescriptors | string (byte) | Proto descriptors stored in the database. Contains a protobuf-serialized google.protobuf.FileDescriptorSet. For more details, see protobuffer self description. |
statements | array | A list of formatted DDL statements defining the schema of the database specified in the request. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
projects_instances_databases_get_ddl | select | projectsId , instancesId , databasesId | 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 API. | |
projects_instances_databases_update_ddl | update | projectsId , instancesId , databasesId | Updates the schema of a Cloud Spanner database by creating/altering/dropping tables, columns, indexes, etc. The returned long-running operation will have a name of the format /operations/ and can be used to track execution of the schema change(s). The metadata field type is UpdateDatabaseDdlMetadata. The operation has no response. |
Parameters
Parameters can be passed in the WHERE
clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
Name | Datatype | Description |
---|---|---|
databasesId | string | |
instancesId | string | |
projectsId | string |
SELECT
examples
- projects_instances_databases_get_ddl
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 API.
SELECT
protoDescriptors,
statements
FROM google.spanner.databases_ddl
WHERE projectsId = '{{ projectsId }}' -- required
AND instancesId = '{{ instancesId }}' -- required
AND databasesId = '{{ databasesId }}' -- required;
UPDATE
examples
- projects_instances_databases_update_ddl
Updates the schema of a Cloud Spanner database by creating/altering/dropping tables, columns, indexes, etc. The returned long-running operation will have a name of the format /operations/
and can be used to track execution of the schema change(s). The metadata field type is UpdateDatabaseDdlMetadata. The operation has no response.
UPDATE google.spanner.databases_ddl
SET
data__statements = '{{ statements }}',
data__operationId = '{{ operationId }}',
data__protoDescriptors = '{{ protoDescriptors }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND instancesId = '{{ instancesId }}' --required
AND databasesId = '{{ databasesId }}' --required
RETURNING
name,
done,
error,
metadata,
response;