Questions tagged [pynamodb]
34 questions
3
votes
1 answer
Is it possible to generate a BETWEEN query on a DynamoDB Global Secondary Index using an exclusive endpoint?
By default, the endpoints of a BETWEEN query are inclusive. I want to query for a range of datetimes using an exclusive endpoint.
I'm currently using pynamo, so my query is:
Item.my_index.query(
hash_key=hash_key_id,
…

Ben
- 380
- 1
- 9
3
votes
3 answers
JSON representation PynamoDB Instance
I am having trouble getting the JSON representation from PynamoDB instance. Here is the Model.
class MyTest(Model):
"""
Model class representing the Golden table attributes.
"""
class Meta:
table_name = "my-test"
#…

Twinkling Star
- 135
- 2
- 14
2
votes
2 answers
pynamodb last_evaluated_key always return null
I'm using Pynamodb for interacting with dynamodb.
However, last_evaluated_key always returns null even if there are multiple items.
When I run this query
results = RecruiterProfileModel.profile_index.query(
hash_key=UserEnum.RECRUITER,
…

Koushik Das
- 9,678
- 3
- 51
- 50
2
votes
2 answers
Multiple DynamoDB(PynamoDB) Queries with FastAPI endpoint raising BrokenResourceError
I'm trying to make multiple queries within one API request. I'm finding that I can make 1 query with no issues but when I try and do multiple within the same request I end up with a BrokenResourceError. I do get the return value to be what I want…

Sitruc
- 31
- 4
2
votes
1 answer
PynamoDB - Query or count all items on table
Using PynamoDB, anyone else having issues trying to count all items on table? i have a model that i created a table from.
I'm trying to use ModelName.count() but i keep getting 0 even though i have some items there.
When sending a specific key to…

Ofek Feller
- 23
- 4
2
votes
0 answers
PynamoDB dynamic names for MapAttribute
I'm currently a bit stuck. I have to create a model of our dynamodb using pynamodb, and here's what I have (part of a bigger model, exported from a real user in DB)
packs = [
{
"exos": {
"4": {
"start": 1529411739,
"session":…

juleslasne
- 580
- 3
- 22
2
votes
1 answer
Does the bulk write operation in DynamoDB utilize a multi-threading strategy?
I'm writing entries into a DynamoDB table:
import time
...
for item in my_big_map.items():
Ddb_model(column1=item[0], column2=item[1], column_timestamp=time.time()).save()
I suspect this is slow so I was thinking about using a multi-threading…

noobie2023
- 721
- 8
- 25
2
votes
0 answers
PynamoDB: how to update an attribute in a ListAttribute of MapAttribute
I am learning how to use PynamoDB to work with AWS DynamoDB in my Python code. Here is what I have defined so far:
class OfficeEmployeeMap(MapAttribute):
office_employee_id = NumberAttribute(hash_key=True)
office_employee_direct_ids =…

Malgi
- 680
- 1
- 7
- 20
1
vote
0 answers
Django Design Pattern with NoSQL DynamoDB
This is a general design question as to how to best implement DynamoDB (or NoSQL/Key-Value in general) with the Django ORM for a rather large project with many django apps in it. I am planning on using this in conjunction with a regular SQL DB as…

sebieire
- 418
- 2
- 11
1
vote
0 answers
Using PynamoDB to put an item with new attributes
I have existing DynamoDB tables created through an infrastructure-as-code implementation.
I used TableConnection to connect to the existing table and run the lower level command put_item.
My table is defined with a hash key (userId) and sort key…

Jason Strimpel
- 14,670
- 21
- 76
- 106
1
vote
1 answer
PynamoDB Error for Local Secondary Index: ValueError('Table table_4 has no index: key1_index',)
I am new to pynamodb and I'm trying to query on LSI (already defined in dynamodb main table) and getting the following Exception.
'exception': ValueError('Table table_4 has no index: key1_index',)
UseCase: i wanted to query on LSI on hash_key only,…

Ananya Verma
- 63
- 5
1
vote
1 answer
Displaying DynamoDB data in Django admin panel
I want to show data from DynamoDB on the Django admin panel page. I have tried PynamoDB to create the model and register it with the admin panel.
I am facing the following two issues:
Getting only attribute 'id' instead of all attributes from the…

Muzamil Ahmed
- 11
- 1
1
vote
0 answers
PynamoDB query() returns 0 values while scan() does
I have declared a pretty basic model and testing out query and other functionalities.
I can run scan() and get all of the objects from dynamoDB, but when I run query I don't get back anything.
I looked at examples, documentations and searched on…

Ishan
- 3,303
- 5
- 29
- 47
1
vote
0 answers
PynamoDB TransactWrite update is throwing ValidationException
I have a model that looks like this:
class Task(BaseModel):
Meta = pynamodb_table_meta("my-task")
creator_id = UnicodeAttribute(null=False)
metadata = JSONAttribute(default={}, null=False)
status = UnicodeAttribute(default="new",…

Rupsha Chaudhuri
- 11
- 1
1
vote
0 answers
How to create a lazy loaded, JSON serializable field?
I started with a class representing a DynamoDB database table:
from pynamodb.models import Model
class FooModel(Model):
class Meta:
table_name = "foo"
…
I've got several tests involving this class. Some of them use FooModel…

l0b0
- 55,365
- 30
- 138
- 223