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

Doesn't accept undef as an item value #4

Closed
stevecaldwell77 opened this issue Jan 7, 2015 · 3 comments
Closed

Doesn't accept undef as an item value #4

stevecaldwell77 opened this issue Jan 7, 2015 · 3 comments

Comments

@stevecaldwell77
Copy link

Trying to call put_item on an item with an undef value, e.g.:

$ddb->put_item(
   TableName => $table_name,
   Item => {
     name => 'Test Name'
     email => undef,
   },
   ReturnValues => 'ALL_OLD');

throws the error:

...did not pass type constraint "ItemType"...
    "ItemType" is a subtype of "Map[AttributeNameType,AttributeValueType]"
    Reference {"__CLASS__" => "CE::LeadRequestTransaction::State","_comple...} did not pass type constraint "Map[AttributeNameType,AttributeValueType]"
    "Map[AttributeNameType,AttributeValueType]" constrains each value in the hash with "AttributeValueType"
    "AttributeValueType" is a subtype of "Defined"
    Undef did not pass type constraint "Defined" (in $_->{"clickouts_only"})
    "Defined" is defined as: (defined($_))

You should be able to store these values using DynamoDB's NULL data type:

http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_AttributeValue.html

@rustyconover
Copy link
Owner

This NULL datatype is newer than the code I wrote and not fully baked into the code. Neither is Bool, List or Map. Both would probably be easy to add. Bool would be tricky, because how does perl know its a bool compared to an integer.

Pull requests welcome...

@rustyconover
Copy link
Owner

Actually just track this branch:

https://github.com/rustyconover/Amazon-DynamoDB/compare/feature/new-types

@stevecaldwell77
Copy link
Author

I created a pull request on that branch for a test of some basic types that aren't currently supported. I'll close this bug.

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