-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
How to use cdk to create step function to write to dynamodb? #8108
Comments
hmmm so having had a look at the tests for dynamodb step functions it looks like this should work:
But generates template thus:
Notice there is a blank Item. Of course this is with the
from DynamoPutItemsProps removed. So I'm beginning to think this is an actual bug in the pyhon sdk... |
I've created a repo with a very basic example demonstrates my issue... https://github.com/Lumkani/cdk-python-step-function-aws-cdk-8108 |
@michaelwiles - thank you for taking the time to fill in this thorough report and repro! I'm in the middle of rewriting the task implementations for all service integrations and DynamoDB is the next one up. I'll be making some changes to address this problem. They will be breaking changes to the current implementation. |
Thank you very much |
Replaces the implementation to call DynamoDb from within a task to merge state level properties as a construct. Notable changes: * APIs require an `ITable` to be supplied instead of `tableName` * `partitionKey` and `sortKey` are now represented as `key` * Rationale: aligning with the SDK for making these calls to Dynamo * `DynamoAttributeValue` is now a struct rather than a class * Rationale: the `withX` methods don't translate to every language and with a struct a fluent builder will be generated with a more idiomatic syntax for the language being used Refactored where it seemed sensible. Test expectations have not changed with the exception of the tableName being a reference. Verified the integration test. Closes #8108 BREAKING CHANGE: `Dynamo*` tasks no longer implement`IStepFunctionsTask` and have been replaced byconstructs that can be instantiated directly. See README for examples ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
So I'm really struggling with how to deploy a step function to put an item into a dynamodb table with the python sdk. I eventually want to provide the item via event bridge.
When I get errors I'm not sure if they are real errors or not:
I've tried this:
I really don't know how to use a DynamoAttributeValueMap as this is just a shell in python which is why I'm not using one.
And even for this to run I've had to remove the following line from DynamoPutItemProps:
if isinstance(item, dict): item = DynamoAttributeValueMap(**item)
otherwise I get an "unknown keyword argument id" when I try to run this. Which kinda makes sense as it's trying to unwrap a map and pass it into a constructor that takes no parameters (just self).
A simple example of creating a step function with cdk to write to dynamodb would be very helpful.
I really don't know how to instantiate that map.
The code that I've got - in the example - at least generates the cloudformation template but the item is empty. It is just {}.
When I try to do something like this cause I think that's what I'm supposed to do...
To try and force values into that map I get error:
Just a plain worked example would be useful - though there might also be a bug here...
The text was updated successfully, but these errors were encountered: