PynamoDB: v5.2.0 breaking change? AttributeError: type object 'Meta' has no attribute 'read_capacity_units'
The release of 5.2.0 broke GlobalSecondaryIndex syntax that worked on 5.1.0. Requesting to add a note about it in release notes for 5.2.0
Broken syntax in 5.2.0, but working in 5.1.0
class UserRangeKey(GlobalSecondaryIndex):
class Meta:
index_name = "user-range-key-index"
projection = AllProjection()
user_range_key = UnicodeAttribute(hash_key=True)
Valid syntax in 5.2.0
class UserRangeKey(GlobalSecondaryIndex):
class Meta:
index_name = "user-range-key-index"
projection = AllProjection()
billing_mode = "PAY_PER_REQUEST"
user_range_key = UnicodeAttribute(hash_key=True)
Lines it breaks in is in PR #996
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 18 (13 by maintainers)
Commits related to this issue
- Only set GSI provisioned throughput for provisioned billing modes. Fixes #1017 — committed to pynamodb/PynamoDB by jpinner-lyft 2 years ago
- Only set GSI provisioned throughput for provisioned billing modes. Fixes #1017 — committed to pynamodb/PynamoDB by jpinner-lyft 2 years ago
- Only set GSI provisioned throughput for provisioned billing modes. Fixes #1017 — committed to pynamodb/PynamoDB by jpinner-lyft 2 years ago
- Only set GSI provisioned throughput for provisioned billing modes. Fixes #1017 — committed to pynamodb/PynamoDB by jpinner-lyft 2 years ago
- Only set GSI provisioned throughput for provisioned billing modes. Fixes #1017 — committed to pynamodb/PynamoDB by jpinner-lyft 2 years ago
- Only set GSI provisioned throughput for provisioned billing modes. Fixes #1017 — committed to pynamodb/PynamoDB by jpinner-lyft 2 years ago
- Only set GSI provisioned throughput for provisioned billing modes. Fixes #1017 (#1018) — committed to pynamodb/PynamoDB by jpinner-lyft 2 years ago
- Only set GSI provisioned throughput for provisioned billing modes. Fixes #1017 (#1018) — committed to pynamodb/PynamoDB by jpinner-lyft 2 years ago
- Only set GSI provisioned throughput for provisioned billing modes. Fixes #1017 (#1018) — committed to knap1930/PynamoDB by jpinner-lyft 2 years ago
@lehmat You can specify a separate throughput for each GSI, but not separate billing mode. Billing mode is a table-level setting.
Ahh, you guys are right. I think the culprit is this:
We used to check for the model’s billing mode: https://github.com/pynamodb/PynamoDB/blob/4bbfad68d5053f4adcbd503560efa901bae81315/pynamodb/models.py#L908
but now we’re expecting the index to have a billing mode: https://github.com/pynamodb/PynamoDB/blob/11113283c92a13566515dcd2f514c3aefda8609a/pynamodb/indexes.py#L175