https://serverless-stack.com/ logo
#sst
Title
# sst
s

Seth Geoghegan

02/25/2021, 6:30 PM
I don't see a way to do this with the SST Table construct. This makes me wonder if it's something the SST construct should provide, or if it's not the "sweet spot" for the Table SST abstraction. In other words, is it fair to say that SST aiming to make the common case easier and not cover all use-cases supported by CDK?
f

Frank

02/25/2021, 6:40 PM
Hi @Seth Geoghegan, we will let you pass in a
cdk.Table
construct to the
sst.Table
construct in the coming releases.
This probably doesn’t make sense right now, but when we add DynamoDB streams support to
sst.Table
, you will be able to do something like:
Copy code
new sst.Table(this, "Table", {
  fields: { ... },
  primaryIndex: { ... },
  subscribers: { ... },
});
Where you can simply define the function code to be trigger when ie. a new item is written to the table
And if you need to Table options that are not yet supported by
sst.Table
, you can simply create your table and pass in like:
Copy code
new sst.Table(this, "Table", {
  table: new cdk.Table(...),
  subscribers: { ... },
});
s

Seth Geoghegan

02/25/2021, 7:11 PM
I see, sounds like there are big plans! Nice to see there will be an "escape hatch" option to support features that aren't yet natively supported in SST
j

Jay

02/25/2021, 7:25 PM
Yup we want to make sure with these constructs that there is a way out — https://docs.serverless-stack.com/design-principles#having-an-escape-hatch
s

Seth Geoghegan

02/25/2021, 7:45 PM
Ahh, there it is. Makes sense as you continue to bring functionality online.
3 Views