PynamoDB icon indicating copy to clipboard operation
PynamoDB copied to clipboard

Support tableprefix

Open trondhindenes opened this issue 6 years ago • 3 comments

Since DynamoDB tables are globally unique, it's a bit cumbersome to store the table name inside the model class. It would be awesome to be able to set a "table prefix" on the connection object or similar, so that the model classes themselves could be static and not require dynamic configuration injected. This would allow scenarios like dev/test inside the same aws account etc.

trondhindenes avatar Apr 04 '18 20:04 trondhindenes

I've also found a function (in addition to a prefix or template string) is very useful for automated testing, where I'd use a nonce to isolate integration tests:

nonce = lambda model: model.Meta.table_name + str(time.time())

I think this needs to be somewhere on the Connection object, looking through https://pynamodb.readthedocs.io/en/latest/low_level.html#creating-a-connection

numberoverzero avatar Apr 07 '18 23:04 numberoverzero

This would be so useful

m-melis avatar Sep 25 '22 15:09 m-melis

Were tables names globally unique in 2018? They certainly don't seem to be now:

Names should be meaningful and concise—for example, names such as Products, Books, and Authors are self-explanatory.

ikonst avatar Sep 26 '22 15:09 ikonst