Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bestis opened this issue Sep 16, 2021 · 1 comment
Open

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

bestis opened this issue Sep 16, 2021 · 1 comment
Assignees

Comments

@bestis
Copy link

bestis commented Sep 16, 2021

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!

@koxudaxi
Copy link
Owner

@bestis
I'm sorry for my late reply.
I will investigate the problem.

@koxudaxi koxudaxi self-assigned this Oct 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants