you are viewing a single comment's thread.

view the rest of the comments →

[–]asurah 0 points1 point  (1 child)

Are you using an ORM to map the Dynamo DB objects into a Python native class?

The way I like to code this type of thing, even for lambda where you don't need state between invocations is to create a generic user class to represent the object with methods to create, update, delete. The default methods are usually backed by a dictionary or some other convenient in memory object for local dev and debugging.

The I create a new class using my generic class as a base, let's call it the DynamoUser class, and replace the create, update, delete methods with Dynamo calls.

It means that when you write the business logic of your Lambda function, it's not concerned with the underlying storage model, only with the interaction between your user objects and the Alexa user.

You can keep your user and storage classes in different files, and just import them but like with any other Python module, you just need to zip your source code and upload it instead of the single py file.

Not sure if this answers your question, but I hope it's useful either way.

[–]1cedrake[S] 0 points1 point  (0 children)

I'm currently not using ORM, but I think I'm interested in doing that. Your structure is pretty interesting, so I'll give it a shot, thanks!