databases
Creates, updates, deletes, gets or lists a databases
resource.
Overview
Name | databases |
Type | Resource |
Id | google.sqladmin.databases |
Fields
The following fields are returned by SELECT
queries:
- get
- list
Successful response
Name | Datatype | Description |
---|---|---|
name | string | The name of the database in the Cloud SQL instance. This does not include the project ID or instance name. |
charset | string | The Cloud SQL charset value. |
collation | string | The Cloud SQL collation value. |
etag | string | This field is deprecated and will be removed from a future version of the API. |
instance | string | The name of the Cloud SQL instance. This does not include the project ID. |
kind | string | This is always sql#database . |
project | string | The project ID of the project containing the Cloud SQL database. The Google apps domain is prefixed if applicable. |
selfLink | string | The URI of this resource. |
sqlserverDatabaseDetails | object | Represents a Sql Server database on the Cloud SQL instance. (id: SqlServerDatabaseDetails) |
Successful response
Name | Datatype | Description |
---|---|---|
items | array | List of database resources in the instance. |
kind | string | This is always sql#databasesList . |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get | select | project , instance , database | Retrieves a resource containing information about a database inside a Cloud SQL instance. | |
list | select | project , instance | Lists databases in the specified Cloud SQL instance. | |
insert | insert | project , instance | Inserts a resource containing information about a database inside a Cloud SQL instance. Note: You can't modify the default character set and collation. | |
patch | update | project , instance , database | Partially updates a resource containing information about a database inside a Cloud SQL instance. This method supports patch semantics. | |
update | replace | project , instance , database | Updates a resource containing information about a database inside a Cloud SQL instance. | |
delete | delete | project , instance , database | Deletes a database from a Cloud SQL instance. |
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 |
---|---|---|
database | string | |
instance | string | |
project | string |
SELECT
examples
- get
- list
Retrieves a resource containing information about a database inside a Cloud SQL instance.
SELECT
name,
charset,
collation,
etag,
instance,
kind,
project,
selfLink,
sqlserverDatabaseDetails
FROM google.sqladmin.databases
WHERE project = '{{ project }}' -- required
AND instance = '{{ instance }}' -- required
AND database = '{{ database }}' -- required;
Lists databases in the specified Cloud SQL instance.
SELECT
items,
kind
FROM google.sqladmin.databases
WHERE project = '{{ project }}' -- required
AND instance = '{{ instance }}' -- required;
INSERT
examples
- insert
- Manifest
Inserts a resource containing information about a database inside a Cloud SQL instance. Note: You can't modify the default character set and collation.
INSERT INTO google.sqladmin.databases (
data__kind,
data__charset,
data__collation,
data__etag,
data__name,
data__instance,
data__selfLink,
data__project,
data__sqlserverDatabaseDetails,
project,
instance
)
SELECT
'{{ kind }}',
'{{ charset }}',
'{{ collation }}',
'{{ etag }}',
'{{ name }}',
'{{ instance }}',
'{{ selfLink }}',
'{{ project }}',
'{{ sqlserverDatabaseDetails }}',
'{{ project }}',
'{{ instance }}'
RETURNING
name,
acquireSsrsLeaseContext,
apiWarning,
backupContext,
endTime,
error,
exportContext,
importContext,
insertTime,
kind,
operationType,
selfLink,
startTime,
status,
subOperationType,
targetId,
targetLink,
targetProject,
user
;
# Description fields are for documentation purposes
- name: databases
props:
- name: project
value: string
description: Required parameter for the databases resource.
- name: instance
value: string
description: Required parameter for the databases resource.
- name: kind
value: string
description: >
This is always `sql#database`.
- name: charset
value: string
description: >
The Cloud SQL charset value.
- name: collation
value: string
description: >
The Cloud SQL collation value.
- name: etag
value: string
description: >
This field is deprecated and will be removed from a future version of the API.
- name: name
value: string
description: >
The name of the database in the Cloud SQL instance. This does not include the project ID or instance name.
- name: instance
value: string
description: >
The name of the Cloud SQL instance. This does not include the project ID.
- name: selfLink
value: string
description: >
The URI of this resource.
- name: project
value: string
description: >
The project ID of the project containing the Cloud SQL database. The Google apps domain is prefixed if applicable.
- name: sqlserverDatabaseDetails
value: object
description: >
Represents a Sql Server database on the Cloud SQL instance.
UPDATE
examples
- patch
Partially updates a resource containing information about a database inside a Cloud SQL instance. This method supports patch semantics.
UPDATE google.sqladmin.databases
SET
data__kind = '{{ kind }}',
data__charset = '{{ charset }}',
data__collation = '{{ collation }}',
data__etag = '{{ etag }}',
data__name = '{{ name }}',
data__instance = '{{ instance }}',
data__selfLink = '{{ selfLink }}',
data__project = '{{ project }}',
data__sqlserverDatabaseDetails = '{{ sqlserverDatabaseDetails }}'
WHERE
project = '{{ project }}' --required
AND instance = '{{ instance }}' --required
AND database = '{{ database }}' --required
RETURNING
name,
acquireSsrsLeaseContext,
apiWarning,
backupContext,
endTime,
error,
exportContext,
importContext,
insertTime,
kind,
operationType,
selfLink,
startTime,
status,
subOperationType,
targetId,
targetLink,
targetProject,
user;
REPLACE
examples
- update
Updates a resource containing information about a database inside a Cloud SQL instance.
REPLACE google.sqladmin.databases
SET
data__kind = '{{ kind }}',
data__charset = '{{ charset }}',
data__collation = '{{ collation }}',
data__etag = '{{ etag }}',
data__name = '{{ name }}',
data__instance = '{{ instance }}',
data__selfLink = '{{ selfLink }}',
data__project = '{{ project }}',
data__sqlserverDatabaseDetails = '{{ sqlserverDatabaseDetails }}'
WHERE
project = '{{ project }}' --required
AND instance = '{{ instance }}' --required
AND database = '{{ database }}' --required
RETURNING
name,
acquireSsrsLeaseContext,
apiWarning,
backupContext,
endTime,
error,
exportContext,
importContext,
insertTime,
kind,
operationType,
selfLink,
startTime,
status,
subOperationType,
targetId,
targetLink,
targetProject,
user;
DELETE
examples
- delete
Deletes a database from a Cloud SQL instance.
DELETE FROM google.sqladmin.databases
WHERE project = '{{ project }}' --required
AND instance = '{{ instance }}' --required
AND database = '{{ database }}' --required;