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

Why boto3.resource("dynamodb") does not have transact_write_items? #3081

Closed
lays147 opened this issue Dec 1, 2021 · 2 comments
Closed

Why boto3.resource("dynamodb") does not have transact_write_items? #3081

lays147 opened this issue Dec 1, 2021 · 2 comments
Assignees
Labels
duplicate This issue is a duplicate. dynamodb feature-request This issue requests a feature. resources

Comments

@lays147
Copy link

lays147 commented Dec 1, 2021

Hi.
I'm writing an application using boto3 resource for DynamoDB to avoid writing the type of my attributes. So far so good, until I needed the transact_write_items operation to validate some business rules of a put_item operation. And this operation is only available in the boto3.client("dynamodb").
So it raises the question of why this feature is not available within the resource? I wouldn't like to set up two clients in my app just for this case of a transaction.

@lays147 lays147 added guidance Question that needs advice or information. needs-triage This issue or PR still needs to be triaged. labels Dec 1, 2021
@stobrien89 stobrien89 added feature-request This issue requests a feature. dynamodb resources and removed guidance Question that needs advice or information. needs-triage This issue or PR still needs to be triaged. labels Dec 2, 2021
@stobrien89
Copy link
Contributor

Hi @lays147,

Thanks for reaching out! The DynamoDB resource model contains most of the core DynamoDB operations, but has not received any updates since 2016. The transact_write_items operation was introduced in 2018. Marking this as a feature request— We'll definitely consider updating the model depending on how much traction this gets.

To work around this, you could access the meta client on the resource— This will give you access to all of the client operations available to DynamoDB:

import boto3 

resource = boto3.resource('dynamodb')

response = resource.meta.client.transact_write_items(TransactItems=[])

Hope this helps!

@tim-finnigan tim-finnigan self-assigned this Mar 16, 2022
@tim-finnigan
Copy link
Contributor

I'm going to close this as a duplicate of a request made earlier last year in botocore: boto/botocore#2373

@tim-finnigan tim-finnigan added the duplicate This issue is a duplicate. label Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue is a duplicate. dynamodb feature-request This issue requests a feature. resources
Projects
None yet
Development

No branches or pull requests

3 participants