'PynamoDB same model with multipe databases

The way PynamoDB is implemented is that it looks to a specific single DynamoDB table:

class UserModel(Model):
    class Meta:
        # Specific table.
        table_name = 'dynamodb-user'
        region = 'us-west-1'

The way my infrastructure works is that it has as many dynamodb tables as I have clients, so a single Lambda function has to deal with any amount of separate tables that are identical in structure e.g. represent "UserModel". I can't specify a concrete one.

How would I make this model definition dynamic?

Thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source