I am using pynamodb==3.3.3
to scan items with the attributes_to_get
condition, but get an exception that I can't solve:
File "/Users/user/Documents/project/script.py", line 250, in filter_writable_snapshots
existing_snapshots = ItemSnapshot.scan(attributes_to_get=['id'])
File "/Users/user/Documents/project/venv/lib/python3.7/site-packages/pynamodb/models.py", line 790, in scan
filters=filters
File "/Users/users/Documents/project/venv/lib/python3.7/site-packages/pynamodb/models.py", line 1050, in _build_filters
raise ValueError("Attribute {0} specified for filter does not exist.".format(attr_name))
ValueError: Attribute attributes_to_get specified for filter does not exist.
The model has a field id
.
from pynamodb.models import Model
from pynamodb.attributes import UnicodeAttribute
class ItemSnapshot(Model):
class Meta:
table_name = 'my_table'
id = UnicodeAttribute(hash_key=True)
other_field = UnicodeAttribute()
I am trying to load only the id
field.
existing_snapshots = ItemSnapshot.scan(attributes_to_get=['id'])
Am I doing anything wrong here or why is the request crashing? The strack trace looks like it would try to find the attribute attributes_to_get
which doesn't make any sense to me.
I already check that the class's attribute id
does exist.