You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
File "/root/myproject/mystatement/src/deps/event_store.py", line 64, in main
await andrew.save()
File "/root/deps/miniconda3/envs/spps/lib/python3.8/site-packages/aredis_om/model/model.py", line 1303, in save
await db.hset(self.key(), mapping=document)
File "/root/deps/miniconda3/envs/spps/lib/python3.8/site-packages/aioredis/client.py", line 1064, in execute_command
return await self.parse_response(conn, command_name, **options)
File "/root/deps/miniconda3/envs/spps/lib/python3.8/site-packages/aioredis/client.py", line 1080, in parse_response
response = await connection.read_response()
File "/root/deps/miniconda3/envs/spps/lib/python3.8/site-packages/aioredis/connection.py", line 868, in read_response
raise response from None
aioredis.exceptions.ResponseError: wrong number of arguments for 'hset' command
above exception happened after running:
class Customer(HashModel):
first_name: str
last_name: str
email: str
join_date: datetime.date
age: int
bio: Optional[str]
# First, we create a new `Customer` object:
andrew = Customer(
first_name="Andrew",
last_name="Brookins",
email="andrew.brookins@example.com",
join_date=datetime.date.today(),
age=38,
bio="Python developer, works at Redis, Inc.",
)
print(andrew.pk)
await andrew.save()
a = await Customer.get(andrew.pk)
print(a)
pip show aioredis:
Name: aioredis
Version: 2.0.0
pip show redis-om
Name: redis-om
Version: 0.0.20
The text was updated successfully, but these errors were encountered:
What version of Redis server are you running this against please? HSET started to accept multiple name/value pairs from Redis 4 onwards (https://redis.io/commands/hset/) and if you are using an older Redis server you'll need to move to at least version 5, preferably 6.
What version of Redis server are you running this against please? HSET started to accept multiple name/value pairs from Redis 4 onwards (https://redis.io/commands/hset/) and if you are using an older Redis server you'll need to move to at least version 5, preferably 6.
Hi there - this is working for me, I did have to change example.com in the email from the README to something else as the email validator appears to actually check for a valid domain... other than that it worked as shown in the README:
importdatetimefromtypingimportOptionalfrompydanticimportEmailStrfromredis_omimportHashModelclassCustomer(HashModel):
first_name: strlast_name: stremail: EmailStrjoin_date: datetime.dateage: intbio: Optional[str]
# First, we create a new `Customer` object:andrew=Customer(
first_name="Andrew",
last_name="Brookins",
email="andrew.brookins@whatever.com",
join_date=datetime.date.today(),
age=38,
bio="Python developer, works at Redis, Inc."
)
# The model generates a globally unique primary key automatically# without needing to talk to Redis.print(andrew.pk)
# > "01FJM6PH661HCNNRC884H6K30C"# We can save the model to Redis by calling `save()`:andrew.save()
# Expire the model after 2 mins (120 seconds)andrew.expire(120)
# To retrieve this customer with its primary key, we use `Customer.get()`:assertCustomer.get(andrew.pk) ==andrew
below is the detail of the exception:
File "/root/myproject/mystatement/src/deps/event_store.py", line 64, in main
await andrew.save()
File "/root/deps/miniconda3/envs/spps/lib/python3.8/site-packages/aredis_om/model/model.py", line 1303, in save
await db.hset(self.key(), mapping=document)
File "/root/deps/miniconda3/envs/spps/lib/python3.8/site-packages/aioredis/client.py", line 1064, in execute_command
return await self.parse_response(conn, command_name, **options)
File "/root/deps/miniconda3/envs/spps/lib/python3.8/site-packages/aioredis/client.py", line 1080, in parse_response
response = await connection.read_response()
File "/root/deps/miniconda3/envs/spps/lib/python3.8/site-packages/aioredis/connection.py", line 868, in read_response
raise response from None
aioredis.exceptions.ResponseError: wrong number of arguments for 'hset' command
above exception happened after running:
pip show aioredis:
Name: aioredis
Version: 2.0.0
pip show redis-om
Name: redis-om
Version: 0.0.20
The text was updated successfully, but these errors were encountered: