Step Function — dynamodb query with Boolean Filter

Steve Kim
Mar 5, 2024

--

I am a great fan of AWS step function.

One day, I had trouble querying dynamodb with boolean filter.

I found out that a slightly different syntax should be used in step function in querying with boolean filter.

This is the code that works.

{
"TableName": "addresses",
"ConsistentRead": true,
"FilterExpression":"beingUsed = :beingUsed",
"KeyConditionExpression": "#type = :EOA",
"ProjectionExpression": "#address, beingUsed",
"ExpressionAttributeNames": {
"#address": "address",
"#type": "type"
},
"ExpressionAttributeValues": {
":EOA": {
"S":"EOA"
},
":beingUsed":{
"Bool":false
}
}
}

In the ExpressionAttributeValues, it is neither

":beingUsed":false

nor

":beingUsed":{
"BOOL":false
}

It should be

":beingUsed":{
"Bool":false
}

I hope this one save someone’s time.

Thank you.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Steve Kim
Steve Kim

Written by Steve Kim

A Certified Public Accountant / Hobbyist-programmer-but-dead-serious-specializing JavaScript, ReactJS, NextJS, Rust and AWS.

No responses yet

Write a response