Skip to main content

databases

Creates, updates, deletes, gets or lists a databases resource.

Overview

Namedatabases
TypeResource
Idgoogle.sqladmin.databases

Fields

NameDatatypeDescription
namestringThe name of the database in the Cloud SQL instance. This does not include the project ID or instance name.
charsetstringThe Cloud SQL charset value.
collationstringThe Cloud SQL collation value.
etagstringThis field is deprecated and will be removed from a future version of the API.
instancestringThe name of the Cloud SQL instance. This does not include the project ID.
kindstringThis is always sql#database.
projectstringThe project ID of the project containing the Cloud SQL database. The Google apps domain is prefixed if applicable.
selfLinkstringThe URI of this resource.
sqlserverDatabaseDetailsobjectRepresents a Sql Server database on the Cloud SQL instance.

Methods

NameAccessible byRequired ParamsDescription
getSELECTdatabase, instance, projectRetrieves a resource containing information about a database inside a Cloud SQL instance.
listSELECTinstance, projectLists databases in the specified Cloud SQL instance.
insertINSERTinstance, projectInserts a resource containing information about a database inside a Cloud SQL instance. Note: You can't modify the default character set and collation.
deleteDELETEdatabase, instance, projectDeletes a database from a Cloud SQL instance.
patchUPDATEdatabase, instance, projectPartially updates a resource containing information about a database inside a Cloud SQL instance. This method supports patch semantics.
updateREPLACEdatabase, instance, projectUpdates a resource containing information about a database inside a Cloud SQL instance.

SELECT examples

Lists databases in the specified Cloud SQL instance.

SELECT
name,
charset,
collation,
etag,
instance,
kind,
project,
selfLink,
sqlserverDatabaseDetails
FROM google.sqladmin.databases
WHERE instance = '{{ instance }}'
AND project = '{{ project }}';

INSERT example

Use the following StackQL query and manifest file to create a new databases resource.

/*+ create */
INSERT INTO google.sqladmin.databases (
instance,
project,
charset,
collation,
etag,
name,
instance,
project,
sqlserverDatabaseDetails
)
SELECT
'{{ instance }}',
'{{ project }}',
'{{ charset }}',
'{{ collation }}',
'{{ etag }}',
'{{ name }}',
'{{ instance }}',
'{{ project }}',
'{{ sqlserverDatabaseDetails }}'
;

UPDATE example

Updates a databases resource.

/*+ update */
UPDATE google.sqladmin.databases
SET
charset = '{{ charset }}',
collation = '{{ collation }}',
etag = '{{ etag }}',
name = '{{ name }}',
instance = '{{ instance }}',
project = '{{ project }}',
sqlserverDatabaseDetails = '{{ sqlserverDatabaseDetails }}'
WHERE
database = '{{ database }}'
AND instance = '{{ instance }}'
AND project = '{{ project }}';

REPLACE example

Replaces all fields in the specified databases resource.

/*+ update */
REPLACE google.sqladmin.databases
SET
charset = '{{ charset }}',
collation = '{{ collation }}',
etag = '{{ etag }}',
name = '{{ name }}',
instance = '{{ instance }}',
project = '{{ project }}',
sqlserverDatabaseDetails = '{{ sqlserverDatabaseDetails }}'
WHERE
database = '{{ database }}'
AND instance = '{{ instance }}'
AND project = '{{ project }}';

DELETE example

Deletes the specified databases resource.

/*+ delete */
DELETE FROM google.sqladmin.databases
WHERE database = '{{ database }}'
AND instance = '{{ instance }}'
AND project = '{{ project }}';