I'm running a scan using the .NET SDK for AWS DynamoDB. I'm doing this:
var result = context.Scan<Table>(new[] { new ScanCondition("AttributeName", ScanOperator.Equal, variable) }
This throws the exception
"Unable to find storage information for property [AttributeName]"
The attribute AttributeName
is a non-indexed attribute that currently has mostly no value in it (it's a new attribute I added recently).
I googled the error & all I came up with was the sdk source code, which I could dive into, and I will if noone here can enlighten me.
Amazon DynamoDB stores data in partitions. A partition is an allocation of storage for a table, backed by solid state drives (SSDs) and automatically replicated across multiple Availability Zones within an AWS Region.
On the other hand, Amazon DynamoDB Accelerator (DAX) is a fully managed, highly available, in-memory cache for Amazon DynamoDB that delivers up to a 10 times performance improvement—from milliseconds to microseconds—even at millions of requests per second.
DynamoDB supports the Java Set , List , and Map collection types. The following table summarizes how these Java types map to the DynamoDB types. BOOL (Boolean type), 0 or 1. S (string type).
The DynamoDBContext.Scan<T>()
method only accepts names of public properties of the class T
that is mapped to that table using the [DynamoDBTable()]
attribute. Scan<T>
will not recognize unmapped attributes in the table.
That exception will be thrown if the class T
either doesn't have a public property of that name, or if the property is explicitly marked [DynamoDBIgnore]
.
If you need to scan the table for table attributes that are not modeled, you can use the low-level API provided by AmazonDynamoDBClient.Scan()
, but it won't return objects of type T.
This got me too, sharing my findings hoping it could help someone, I am using C# Object persistent model.
Column names in DynamoDb are in Camel case. C# class properties are not.
[DynamoDBProperty("artist")]
[DynamoDBHashKey]
public string Artist { get; set; }
[DynamoDBProperty("songTitle")]
[DynamoDBRangeKey]
public string SongTitle { get; set; }
Therefore following throws the error,
scanConditions.Add(new ScanCondition("songTitle", ScanOperator.BeginsWith, searchReq.SongTitle));
if (!string.IsNullOrEmpty(searchReq.Difficulty))
To fix,
scanConditions.Add(new ScanCondition("SongTitle", ScanOperator.BeginsWith, searchReq.SongTitle));
if (!string.IsNullOrEmpty(searchReq.Difficulty))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With