amazonka-rds-data-2.0: Amazon RDS DataService SDK.
Copyright(c) 2013-2023 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellSafe-Inferred
LanguageHaskell2010

Amazonka.RDSData.ExecuteStatement

Description

Runs a SQL statement against a database.

If a call isn't part of a transaction because it doesn't include the transactionID parameter, changes that result from the call are committed automatically.

If the binary response data from the database is more than 1 MB, the call is terminated.

Synopsis

Creating a Request

data ExecuteStatement Source #

The request parameters represent the input of a request to run a SQL statement against a database.

See: newExecuteStatement smart constructor.

Constructors

ExecuteStatement' 

Fields

  • continueAfterTimeout :: Maybe Bool

    A value that indicates whether to continue running the statement after the call times out. By default, the statement stops running when the call times out.

    For DDL statements, we recommend continuing to run the statement after the call times out. When a DDL statement terminates before it is finished running, it can result in errors and possibly corrupted data structures.

  • database :: Maybe Text

    The name of the database.

  • formatRecordsAs :: Maybe RecordsFormatType

    A value that indicates whether to format the result set as a single JSON string. This parameter only applies to SELECT statements and is ignored for other types of statements. Allowed values are NONE and JSON. The default value is NONE. The result is returned in the formattedRecords field.

    For usage information about the JSON format for result sets, see Using the Data API in the Amazon Aurora User Guide.

  • includeResultMetadata :: Maybe Bool

    A value that indicates whether to include metadata in the results.

  • parameters :: Maybe [SqlParameter]

    The parameters for the SQL statement.

    Array parameters are not supported.

  • resultSetOptions :: Maybe ResultSetOptions

    Options that control how the result set is returned.

  • schema :: Maybe Text

    The name of the database schema.

    Currently, the schema parameter isn't supported.

  • transactionId :: Maybe Text

    The identifier of a transaction that was started by using the BeginTransaction operation. Specify the transaction ID of the transaction that you want to include the SQL statement in.

    If the SQL statement is not part of a transaction, don't set this parameter.

  • resourceArn :: Text

    The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster.

  • secretArn :: Text

    The ARN of the secret that enables access to the DB cluster. Enter the database user name and password for the credentials in the secret.

    For information about creating the secret, see Create a database secret.

  • sql :: Text

    The SQL statement to run.

Instances

Instances details
ToJSON ExecuteStatement Source # 
Instance details

Defined in Amazonka.RDSData.ExecuteStatement

ToHeaders ExecuteStatement Source # 
Instance details

Defined in Amazonka.RDSData.ExecuteStatement

ToPath ExecuteStatement Source # 
Instance details

Defined in Amazonka.RDSData.ExecuteStatement

ToQuery ExecuteStatement Source # 
Instance details

Defined in Amazonka.RDSData.ExecuteStatement

AWSRequest ExecuteStatement Source # 
Instance details

Defined in Amazonka.RDSData.ExecuteStatement

Associated Types

type AWSResponse ExecuteStatement #

Generic ExecuteStatement Source # 
Instance details

Defined in Amazonka.RDSData.ExecuteStatement

Associated Types

type Rep ExecuteStatement :: Type -> Type #

Read ExecuteStatement Source # 
Instance details

Defined in Amazonka.RDSData.ExecuteStatement

Show ExecuteStatement Source # 
Instance details

Defined in Amazonka.RDSData.ExecuteStatement

NFData ExecuteStatement Source # 
Instance details

Defined in Amazonka.RDSData.ExecuteStatement

Methods

rnf :: ExecuteStatement -> () #

Eq ExecuteStatement Source # 
Instance details

Defined in Amazonka.RDSData.ExecuteStatement

Hashable ExecuteStatement Source # 
Instance details

Defined in Amazonka.RDSData.ExecuteStatement

type AWSResponse ExecuteStatement Source # 
Instance details

Defined in Amazonka.RDSData.ExecuteStatement

type Rep ExecuteStatement Source # 
Instance details

Defined in Amazonka.RDSData.ExecuteStatement

type Rep ExecuteStatement = D1 ('MetaData "ExecuteStatement" "Amazonka.RDSData.ExecuteStatement" "amazonka-rds-data-2.0-IBcRzqxHiGyCjqyJwy4iJz" 'False) (C1 ('MetaCons "ExecuteStatement'" 'PrefixI 'True) (((S1 ('MetaSel ('Just "continueAfterTimeout") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Bool)) :*: S1 ('MetaSel ('Just "database") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text))) :*: (S1 ('MetaSel ('Just "formatRecordsAs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe RecordsFormatType)) :*: (S1 ('MetaSel ('Just "includeResultMetadata") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Bool)) :*: S1 ('MetaSel ('Just "parameters") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [SqlParameter]))))) :*: ((S1 ('MetaSel ('Just "resultSetOptions") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe ResultSetOptions)) :*: (S1 ('MetaSel ('Just "schema") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "transactionId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)))) :*: (S1 ('MetaSel ('Just "resourceArn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: (S1 ('MetaSel ('Just "secretArn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "sql") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text))))))

newExecuteStatement Source #

Create a value of ExecuteStatement with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

$sel:continueAfterTimeout:ExecuteStatement', executeStatement_continueAfterTimeout - A value that indicates whether to continue running the statement after the call times out. By default, the statement stops running when the call times out.

For DDL statements, we recommend continuing to run the statement after the call times out. When a DDL statement terminates before it is finished running, it can result in errors and possibly corrupted data structures.

$sel:database:ExecuteStatement', executeStatement_database - The name of the database.

$sel:formatRecordsAs:ExecuteStatement', executeStatement_formatRecordsAs - A value that indicates whether to format the result set as a single JSON string. This parameter only applies to SELECT statements and is ignored for other types of statements. Allowed values are NONE and JSON. The default value is NONE. The result is returned in the formattedRecords field.

For usage information about the JSON format for result sets, see Using the Data API in the Amazon Aurora User Guide.

$sel:includeResultMetadata:ExecuteStatement', executeStatement_includeResultMetadata - A value that indicates whether to include metadata in the results.

$sel:parameters:ExecuteStatement', executeStatement_parameters - The parameters for the SQL statement.

Array parameters are not supported.

$sel:resultSetOptions:ExecuteStatement', executeStatement_resultSetOptions - Options that control how the result set is returned.

$sel:schema:ExecuteStatement', executeStatement_schema - The name of the database schema.

Currently, the schema parameter isn't supported.

$sel:transactionId:ExecuteStatement', executeStatement_transactionId - The identifier of a transaction that was started by using the BeginTransaction operation. Specify the transaction ID of the transaction that you want to include the SQL statement in.

If the SQL statement is not part of a transaction, don't set this parameter.

$sel:resourceArn:ExecuteStatement', executeStatement_resourceArn - The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster.

$sel:secretArn:ExecuteStatement', executeStatement_secretArn - The ARN of the secret that enables access to the DB cluster. Enter the database user name and password for the credentials in the secret.

For information about creating the secret, see Create a database secret.

$sel:sql:ExecuteStatement', executeStatement_sql - The SQL statement to run.

Request Lenses

executeStatement_continueAfterTimeout :: Lens' ExecuteStatement (Maybe Bool) Source #

A value that indicates whether to continue running the statement after the call times out. By default, the statement stops running when the call times out.

For DDL statements, we recommend continuing to run the statement after the call times out. When a DDL statement terminates before it is finished running, it can result in errors and possibly corrupted data structures.

executeStatement_formatRecordsAs :: Lens' ExecuteStatement (Maybe RecordsFormatType) Source #

A value that indicates whether to format the result set as a single JSON string. This parameter only applies to SELECT statements and is ignored for other types of statements. Allowed values are NONE and JSON. The default value is NONE. The result is returned in the formattedRecords field.

For usage information about the JSON format for result sets, see Using the Data API in the Amazon Aurora User Guide.

executeStatement_includeResultMetadata :: Lens' ExecuteStatement (Maybe Bool) Source #

A value that indicates whether to include metadata in the results.

executeStatement_parameters :: Lens' ExecuteStatement (Maybe [SqlParameter]) Source #

The parameters for the SQL statement.

Array parameters are not supported.

executeStatement_resultSetOptions :: Lens' ExecuteStatement (Maybe ResultSetOptions) Source #

Options that control how the result set is returned.

executeStatement_schema :: Lens' ExecuteStatement (Maybe Text) Source #

The name of the database schema.

Currently, the schema parameter isn't supported.

executeStatement_transactionId :: Lens' ExecuteStatement (Maybe Text) Source #

The identifier of a transaction that was started by using the BeginTransaction operation. Specify the transaction ID of the transaction that you want to include the SQL statement in.

If the SQL statement is not part of a transaction, don't set this parameter.

executeStatement_resourceArn :: Lens' ExecuteStatement Text Source #

The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster.

executeStatement_secretArn :: Lens' ExecuteStatement Text Source #

The ARN of the secret that enables access to the DB cluster. Enter the database user name and password for the credentials in the secret.

For information about creating the secret, see Create a database secret.

Destructuring the Response

data ExecuteStatementResponse Source #

The response elements represent the output of a request to run a SQL statement against a database.

See: newExecuteStatementResponse smart constructor.

Constructors

ExecuteStatementResponse' 

Fields

  • columnMetadata :: Maybe [ColumnMetadata]

    Metadata for the columns included in the results. This field is blank if the formatRecordsAs parameter is set to JSON.

  • formattedRecords :: Maybe Text

    A string value that represents the result set of a SELECT statement in JSON format. This value is only present when the formatRecordsAs parameter is set to JSON.

    The size limit for this field is currently 10 MB. If the JSON-formatted string representing the result set requires more than 10 MB, the call returns an error.

  • generatedFields :: Maybe [Field]

    Values for fields generated during a DML request.

     <note> <p>The <code>generatedFields</code> data isn't supported by Aurora PostgreSQL. To get the values of generated fields, use the <code>RETURNING</code> clause. For more information, see <a href="https://www.postgresql.org/docs/10/dml-returning.html">Returning Data From Modified Rows</a> in the PostgreSQL documentation.</p> </note>
  • numberOfRecordsUpdated :: Maybe Integer

    The number of records updated by the request.

  • records :: Maybe [[Field]]

    The records returned by the SQL statement. This field is blank if the formatRecordsAs parameter is set to JSON.

  • httpStatus :: Int

    The response's http status code.

Instances

Instances details
Generic ExecuteStatementResponse Source # 
Instance details

Defined in Amazonka.RDSData.ExecuteStatement

Associated Types

type Rep ExecuteStatementResponse :: Type -> Type #

Read ExecuteStatementResponse Source # 
Instance details

Defined in Amazonka.RDSData.ExecuteStatement

Show ExecuteStatementResponse Source # 
Instance details

Defined in Amazonka.RDSData.ExecuteStatement

NFData ExecuteStatementResponse Source # 
Instance details

Defined in Amazonka.RDSData.ExecuteStatement

Eq ExecuteStatementResponse Source # 
Instance details

Defined in Amazonka.RDSData.ExecuteStatement

type Rep ExecuteStatementResponse Source # 
Instance details

Defined in Amazonka.RDSData.ExecuteStatement

type Rep ExecuteStatementResponse = D1 ('MetaData "ExecuteStatementResponse" "Amazonka.RDSData.ExecuteStatement" "amazonka-rds-data-2.0-IBcRzqxHiGyCjqyJwy4iJz" 'False) (C1 ('MetaCons "ExecuteStatementResponse'" 'PrefixI 'True) ((S1 ('MetaSel ('Just "columnMetadata") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [ColumnMetadata])) :*: (S1 ('MetaSel ('Just "formattedRecords") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "generatedFields") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [Field])))) :*: (S1 ('MetaSel ('Just "numberOfRecordsUpdated") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Integer)) :*: (S1 ('MetaSel ('Just "records") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [[Field]])) :*: S1 ('MetaSel ('Just "httpStatus") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int)))))

newExecuteStatementResponse Source #

Create a value of ExecuteStatementResponse with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

$sel:columnMetadata:ExecuteStatementResponse', executeStatementResponse_columnMetadata - Metadata for the columns included in the results. This field is blank if the formatRecordsAs parameter is set to JSON.

$sel:formattedRecords:ExecuteStatementResponse', executeStatementResponse_formattedRecords - A string value that represents the result set of a SELECT statement in JSON format. This value is only present when the formatRecordsAs parameter is set to JSON.

The size limit for this field is currently 10 MB. If the JSON-formatted string representing the result set requires more than 10 MB, the call returns an error.

ExecuteStatementResponse, executeStatementResponse_generatedFields - Values for fields generated during a DML request.

 <note> <p>The <code>generatedFields</code> data isn't supported by Aurora PostgreSQL. To get the values of generated fields, use the <code>RETURNING</code> clause. For more information, see <a href="https://www.postgresql.org/docs/10/dml-returning.html">Returning Data From Modified Rows</a> in the PostgreSQL documentation.</p> </note>

$sel:numberOfRecordsUpdated:ExecuteStatementResponse', executeStatementResponse_numberOfRecordsUpdated - The number of records updated by the request.

$sel:records:ExecuteStatementResponse', executeStatementResponse_records - The records returned by the SQL statement. This field is blank if the formatRecordsAs parameter is set to JSON.

$sel:httpStatus:ExecuteStatementResponse', executeStatementResponse_httpStatus - The response's http status code.

Response Lenses

executeStatementResponse_columnMetadata :: Lens' ExecuteStatementResponse (Maybe [ColumnMetadata]) Source #

Metadata for the columns included in the results. This field is blank if the formatRecordsAs parameter is set to JSON.

executeStatementResponse_formattedRecords :: Lens' ExecuteStatementResponse (Maybe Text) Source #

A string value that represents the result set of a SELECT statement in JSON format. This value is only present when the formatRecordsAs parameter is set to JSON.

The size limit for this field is currently 10 MB. If the JSON-formatted string representing the result set requires more than 10 MB, the call returns an error.

executeStatementResponse_generatedFields :: Lens' ExecuteStatementResponse (Maybe [Field]) Source #

Values for fields generated during a DML request.

 <note> <p>The <code>generatedFields</code> data isn't supported by Aurora PostgreSQL. To get the values of generated fields, use the <code>RETURNING</code> clause. For more information, see <a href="https://www.postgresql.org/docs/10/dml-returning.html">Returning Data From Modified Rows</a> in the PostgreSQL documentation.</p> </note>

executeStatementResponse_records :: Lens' ExecuteStatementResponse (Maybe [[Field]]) Source #

The records returned by the SQL statement. This field is blank if the formatRecordsAs parameter is set to JSON.