redis / redis-om-python

Object mapping, and more, for Redis and Python
MIT License
1.12k stars 112 forks source link

Fixes issue decode_responses is set to True regardless if REDIS_OM_UR… #373

Closed melder closed 2 years ago

melder commented 2 years ago

…L environment variable is set.

Otherwise these warnings pop up when persisting objects:

Could not parse Redis response. Error was: "keywords must be strings". Probably, the connection is not set to decode responses from bytes. Attempting to decode response using the encoding set on model class (<class 'redis_om.model.model.ModelMeta'>. Encoding: utf-8.

To reproduce:

  1. Set "REDIS_OM_URL" environment variable: os.environ["REDIS_OM_URL"] = "redis://@localhost:6379"

  2. Copy the model in the example (or whatever you have at hand) and try to do a "get", e.g:

>>> res = o.get('63176e6c-1a8e-40ca-a2ce-d36fcd823009')
Could not parse Redis response. Error was: "keywords must be strings". Probably, the connection is not set to decode responses from bytes. Attempting to decode response using the encoding set on model class (<class 'redis_om.model.model.ModelMeta'>. Encoding: utf-8.

"res" still correctly gets the record data, but the warnings are annoying.

codecov-commenter commented 2 years ago

Codecov Report

Merging #373 (db1f166) into main (788d3df) will increase coverage by 0.17%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #373      +/-   ##
==========================================
+ Coverage   77.64%   77.81%   +0.17%     
==========================================
  Files          14       14              
  Lines        1154     1154              
==========================================
+ Hits          896      898       +2     
+ Misses        258      256       -2     
Flag Coverage Δ
unit 77.81% <100.00%> (+0.17%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
aredis_om/connections.py 90.00% <100.00%> (+20.00%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.