databases_ddl
Creates, updates, deletes, gets or lists a databases_ddl
resource.
Overview
Name | databases_ddl |
Type | Resource |
Id | google.spanner.databases_ddl |
Fields
Name | Datatype | Description |
---|---|---|
protoDescriptors | string | 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
Name | Accessible by | Required Params | Description |
---|---|---|---|
projects_instances_databases_get_ddl | SELECT | databasesId, instancesId, projectsId | 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 | databasesId, instancesId, projectsId | 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. |
SELECT
examples
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 databasesId = '{{ databasesId }}'
AND instancesId = '{{ instancesId }}'
AND projectsId = '{{ projectsId }}';
UPDATE
example
Updates a databases_ddl
resource.
/*+ update */
UPDATE google.spanner.databases_ddl
SET
statements = '{{ statements }}',
operationId = '{{ operationId }}',
protoDescriptors = '{{ protoDescriptors }}'
WHERE
databasesId = '{{ databasesId }}'
AND instancesId = '{{ instancesId }}'
AND projectsId = '{{ projectsId }}';