FSharp.AWS.DynamoDB icon indicating copy to clipboard operation
FSharp.AWS.DynamoDB copied to clipboard

using Map.containsKey does not use expression attribute

Open f-messner opened this issue 2 years ago • 1 comments

Hello,

I have DynamoDB entries which hold a F# Map<string,string> called values, with keys following a specific schema (X+GUID, where X is a string with letters and digits AND special characters, namely dots, colons underscores and dashes (. : _ -), and GUID is a regular old guid also containing dashes.

Now when I use this library for a query like: <@ fun p -> Map.containsKey s p.values @> |> template.PrecomputeConditionalExpr

I run into some problems, since the generated expression looks like this: attribute_exists ( #ATTR6.xxx:xxx.xxx:xx.xxx:x.xx_xxxx-xx+xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx-xxxxxxxx) that is, values is replaced with a expression attribute (I think that is the right DynamoDB term? Sorry, somewhat new to AWS), but my Map key is not.

Printing out the .Names of this ConditionExpression as well I can see that ATTR6 is mapped correctly [(#ATTR6, values)]

The issue here is that the expression contains illegal characters (running the query fails at the first : but I guess the dots would also do it) and I assume would need to use a expression attribute as well?

Is this something I can fix with correct usage of the library, a bug/oversight in the library, or something that cannot be supported?

Cheers!

f-messner avatar Nov 23 '22 17:11 f-messner

This is probably a bug - I'll need to dig in to what it should be doing there.

samritchie avatar Nov 25 '22 07:11 samritchie