简体   繁体   English

DynamoDB AutoIncrement 主键 Python 烧瓶

[英]DynamoDB AutoIncrement Primary key Python flask

I am working on python flask with Dynamo DB ,is there any functionality to auto increment the primary key in AWS Dynamo DB (like SQL.AUTOINCREMENT), Any suggestion on this?我正在使用 Dynamo DB 处理 python flask,是否有任何功能可以自动增加 AWS Dynamo DB 中的主键(如 SQL.AUTOINCREMENT),对此有何建议? how to handle the AUTOINCREMENT Feature in AWS DynamoDB.如何处理 AWS DynamoDB 中的 AUTOINCREMENT 功能。

Generally speaking, using an auto-increment primary key is not going to be best practice.一般来说,使用自增主键不是最佳实践。 If you really want to do it, you could use a lambda function and another dynamodb table that stores the last used value, but you would be much better off picking a better primary key so that you don't run into performance problems down the road.如果你真的想这样做,你可以使用一个 lambda 函数和另一个存储最后使用的值的 dynamodb 表,但你最好选择一个更好的主键,这样你就不会在路上遇到性能问题.

Generally speaking, a GUID is a very easy to use alternative for a primary key where you don't have another obvious field to use.一般来说,对于没有其他明显字段可以使用的主键,GUID 是一种非常易于使用的替代方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM