sql_mode
Creates, updates, deletes, gets or lists a sql_mode
resource.
Overview
Name | sql_mode |
Type | Resource |
Id | digitalocean.databases.sql_mode |
Fields
The following fields are returned by SELECT
queries:
- databases_get_sql_mode
A JSON string with a key of sql_mode
.
Name | Datatype | Description |
---|---|---|
sql_mode | string | A string specifying the configured SQL modes for the MySQL cluster. (example: ANSI,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,STRICT_ALL_TABLES) |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
databases_get_sql_mode | select | database_cluster_uuid | To retrieve the configured SQL modes for an existing MySQL cluster, send a GET request to /v2/databases/$DATABASE_ID/sql_mode .The response will be a JSON object with a sql_mode key. This will be set to a string representing the configured SQL modes. | |
databases_update_sql_mode | replace | database_cluster_uuid , data__sql_mode | To configure the SQL modes for an existing MySQL cluster, send a PUT request to /v2/databases/$DATABASE_ID/sql_mode specifying the desired modes. See the official MySQL 8 documentation for a full list of supported SQL modes.A successful request will receive a 204 No Content status code with no body in 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 |
---|---|---|
database_cluster_uuid | string (uuid) | A unique identifier for a database cluster. (example: 9cc10173-e9ea-4176-9dbc-a4cee4c4ff30) |
SELECT
examples
- databases_get_sql_mode
To retrieve the configured SQL modes for an existing MySQL cluster, send a GET request to /v2/databases/$DATABASE_ID/sql_mode
.
The response will be a JSON object with a sql_mode
key. This will be set to a string representing the configured SQL modes.
SELECT
sql_mode
FROM digitalocean.databases.sql_mode
WHERE database_cluster_uuid = '{{ database_cluster_uuid }}' -- required;
REPLACE
examples
- databases_update_sql_mode
To configure the SQL modes for an existing MySQL cluster, send a PUT request to /v2/databases/$DATABASE_ID/sql_mode
specifying the desired modes. See the official MySQL 8 documentation for a full list of supported SQL modes.
A successful request will receive a 204 No Content status code with no body in response.
REPLACE digitalocean.databases.sql_mode
SET
data__sql_mode = '{{ sql_mode }}'
WHERE
database_cluster_uuid = '{{ database_cluster_uuid }}' --required
AND data__sql_mode = '{{ sql_mode }}' --required;