Skip to content

Local data api is always using transactions with /Execute #158

@bestis

Description

@bestis

Describe the bug
Local data api is always using transactions and you cannot run queries which you need to run without transactions.

At least this is a big issue with PostgreSQL.

To Reproduce
Steps to reproduce the behavior:

  1. "Connect" to local data-api.
import boto3
client = boto3.client('rds-data', endpoint_url='http://127.0.0.1:8080', aws_access_key_id='aaa', aws_secret_access_key='bbb')
  1. Create new type with /Execute
client.execute_statement(resourceArn='arn:aws:rds:us-east-1:123456789012:cluster:dummy', secretArn='arn:aws:secretsmanager:us-east-1:123456789012:secret:dummy', sql="CREATE type some_t as enum ('A','B');", database='db')
{'ResponseMetadata': {'HTTPStatusCode': 200, 'HTTPHeaders': {'content-length': '49', 'content-type': '*/*; charset=UTF-8'}, 'RetryAttempts': 0}, 'generatedFields': [], 'numberOfRecordsUpdated': 0}
  1. Alter the type with /Execute
client.execute_statement(resourceArn='arn:aws:rds:us-east-1:123456789012:cluster:dummy', secretArn='arn:aws:secretsmanager:us-east-1:123456789012:secret:dummy', sql="ALTER TYPE some_t ADD VALUE IF NOT EXISTS 'NEW_VALUE'", database='db')
  1. See error
Traceback (most recent call last):
    raise error_class(parsed_response, operation_name)
botocore.errorfactory.BadRequestException: An error occurred (BadRequestException) when calling the ExecuteStatement operation: Database error code: 0. Message: ERROR: ALTER TYPE ... ADD cannot run inside a transaction block

Expected behavior
Query will be run without problems.

Additional context
PostgreSQL v10, similar that is available in Aurora Serverless v1.
There should be option to disable always using transactions with /Execute.
Or it should even be the default as that's how the AWS data api works!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions