I've used Amplify (Appsync + DynamoDB) for a MVP i...
# general
n
I've used Amplify (Appsync + DynamoDB) for a MVP in the past and struggled with pagination, sorting and filtering. I appreciate that I am not using DynamoDB in the way that it is designed as I have multiple tables structured like a relational DB. I understand that DynamoDB is quite different when it comes to pagination, sorting and filtering. Has anyone managed to implement a decent mechanism with SST? Am I best using Postgress instead as I'm much more comfortable using SQL for doing this?
a
SST won’t help you with managing you DynamoDB structure 😅 in Dynamo you need to model the data the way you are going to query it There are some great talk regarding this topic, will share a link in a bit

https://youtu.be/HaEPXoXVf2k

, this is from 2018 and there are other talks from the same guy in later years
n
Yeah, I've been through all those in the past when I first started using serverless. A lot of new complexity when a good old relational DB will do what I need really. I'm sure I'll invest some time in learning how to use Dynamo properly at some point.
a
Yeah, I got into a late-stage project that used DynamoDB extensively (a project for a large company) completely wrong. I told them that we are using it wrong and we cannot do a lot of things (one pain point right now is filtering and sorting at the same time on multiple fields + pagination), and I got the answer that it was a business decision to use Dynamo... and right now we are pretty much using it like an SQL database except for some light usage of GSI's and it's horrible. So yeah, if you want to use Dynamo, you better know all your access patterns before hand.
r
Invest in the DynamoDB Book by Alex DeBrie. He details the necessary approaches to all kinds of data structures and access patterns
k
@Neil Balcombe DynamoDB as a managed NO-SQL db also comes with it's own pro and cons or here. I'd recommend using what fits your use case - perhaps look at https://www.dyspatch.io/blog/from-postgresql-to-dynamodb/ to get an idea how a benefits analysis could look like. If your more comfortable with using SQL and there's no need for e.g. a flexible, document based DB structure or Dynamo's other advantages like high throughput for bigger data sets or if you have strong ACID requirements then switching might not be good choice.
a
+1 to Alex Debrie's book , incredibly helpful
t
fwiw using DynamoDB with the ElectroDB client has been amazingly easy
u
there is also nice framework around dynamobdb like dynamodb toolbox https://github.com/jeremydaly/dynamodb-toolbox etc
ö
There are certain bugs in that package
and definitely not maintained
the one @thdxr pointed seems interesting
d
I think the “good” news is that if you rely on something for pagination SQL has and DynamoDB doesn’t, it is unlikely to scale anyway and you will eventually have to change it to a DDB-style anyway. 🙂
j
was gonna say, check out the electrodb client when working with Dynamo…. it’s so nice and easier to used than the toolbox and sdk. Also checkout the
.page()
functionality ;d https://github.com/tywalch/electrodb
has done wonders for working with conditional expressions for me
r
How does it compare to SenseDeep's OneTable? We've found that to be good but keen to understand if there's something even better
j
hrmm, i haven’t used sensedeep’s oneTable myself. I remember seeing that pop up once but was strictly using the SDK during those days ahah
t
I compared to onetable, electro is def better. It's built TS first so you have proper inference everywhere. Also there's a lot of little details that just make it a joy to use
@Jarod Stewart was just thinking yesterday about how much more I actually use conditional expressions because of electro
j
yeah, i think they are the most underused thing about dynamo. At least where I’ve worked in the past.
oooh, and the composite attributes helpers are nice too
t
Great to hear all this @Jarod Stewart ! If you ever have any issues or things you feel could improve the library please let me know!