Closed XChikuX closed 1 year ago
This might be down to your use of providing a database connection in meta... importing the model and calling find should work fine (see here for an example) https://github.com/redis-developer/redis-om-python-flask-skeleton-app
how's your connection getting established in your application where this doesn't work?
Adding Discord discussion link: https://discord.com/channels/697882427875393627/958455824278245406/1061960759090892830
To add on to what @simonprickett said. providing a database connection in meta
This causes the following symptoms:
1) The sync version errors out during import. Thus, both get and find calls fail. 2) The async version only errors out on find(), while Customer.get() works with no issue. Weird
Could we please get this looked at soon? Seems like a fundamental issue that is completely blocking my future progress.
I guess the other follow up question I have here is which file and when do you run the Migrator?
Currently the issue persists whether or not I run the Migrator.
But I ran it in an async main function after all the model definitions with a asyncio.sleep(0)
This boiled down to calling Migrator in the right location. Which is the file where the Model is being used. Closing, Sorry about the confusion guys.
I tried the following:
redis_test.py
Output: []
Since I had no records of customer inserted an empty list is expected.
However, when I try the same command from a different python file testing.py
I get the follow error:
redis.exceptions.ResponseError: :redis_test.Customer:index: no such index
I believe this is a bug.
EDIT: Hold on!! I found something more interesting The sync version errors out during import. Thus, both get and find calls fail. The async version only errors out on find() and
Customer.get()
works with no issue. Weird