Is your feature request related to a problem? Please describe.
Using amplify-cli, we should minimize the manual setup needed in the Aws console when deploying a schema. It's a pain to go to each model where TTL is needed to set it up manually.
Describe the solution you'd like
It would be great to define this in the graphQL schema :
type StreamDataThatHasATTL @model {
id: ID!
data: String
ttl: Int! @ttl
}
This would be useful for us too, as that would get rid of some logic we have in our app to remove rows that are older than X time
This would be a great use case for a custom transformer. See #1396.
@mikeparisstuff Would a custom transformer do the trick here? My understanding is that custom transformers allow you to write custom response + request VTL templates, whereas enabling TTL is strictly about modifying the Dynamo table itself (ideally via cloudformation).
@kaustavghosh06 Can you provide any update on this?
@UnleashedMind ? @yuth ?
@brene ?
+1
Hi! Any sign of update on this?
This would really be great. Is there a possibility to configure this in other places in the source code?
This would minimize the amount of logic that one writes to handle the same. Hope this will/can be implemented soon.
Was somebody able to write a custom @ttl transformer?
any update ??
@avlonder I looked into this but I didn鈥檛 find enough documentation on how to go about building the required transformer when I was looking.
Any information about this?
We are also interested in this.
@mikeparisstuff Would a custom transformer do the trick here? My understanding is that custom transformers allow you to write custom response + request VTL templates, whereas enabling TTL is strictly about modifying the Dynamo table itself (ideally via cloudformation).
@zjullion Thought the same thing at first, but it seems that AWS Amplify actually offers a way to implement such a @ttl
directive by ourselves. They call them transformers as well. See this paragraph in the documentation: https://docs.amplify.aws/cli/plugins/authoring#custom-graphql-transformers
I'll try to build this: https://github.com/flogy/graphql-ttl-transformer
Make sure to leave a 猸愶笍 to motivate me a bit 馃槈 Thanks!
@flogy Please open up an issue on GitHub if you encounter any blockers when working on the custom directive plugin. Left you a star on the repo :D
The graphql-ttl-transformer library is finished, tested and published to NPM 馃殌
It is used exactly the way @vparpoil suggested in the initial post of this issue.
Enjoy and please consider starring the repo if it has helped you saving time and money 馃槉馃檹 Thanks!
@flogy any concerns if I feature the plugin on our docs?
@flogy any concerns if I feature the plugin on our docs?
@renebrandel No, that would be awesome!
@flogy - https://github.com/aws-amplify/docs/pull/2593
I'll close this issue for now given that we've got a documented solution and an amazing 3rd party contribution for this feature. If there is additional interest to have this be built-in, please create a new issue.
Most helpful comment
The graphql-ttl-transformer library is finished, tested and published to NPM 馃殌
It is used exactly the way @vparpoil suggested in the initial post of this issue.
Enjoy and please consider starring the repo if it has helped you saving time and money 馃槉馃檹 Thanks!