Skip to content

redis-om 0.3.2 no longer supports pydantic<2 #646

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
woutdenolf opened this issue Aug 7, 2024 · 5 comments · Fixed by #663
Closed

redis-om 0.3.2 no longer supports pydantic<2 #646

woutdenolf opened this issue Aug 7, 2024 · 5 comments · Fixed by #663

Comments

@woutdenolf
Copy link

woutdenolf commented Aug 7, 2024

pydantic = ">=1.10.2,<3.0.0"

pip install "redis-om" "pydantic<2"
from redis_om import JsonModel
  File.../site-packages/redis_om/__init__.py", line 4, in <module>
    from .model.migrations.migrator import MigrationError, Migrator
  File.../site-packages/redis_om/model/__init__.py", line 2, in <module>
    from .model import (
  File.../site-packages/redis_om/model/model.py", line 2216, in <module>
    class EmbeddedJsonModel(JsonModel, abc.ABC):
  File.../site-packages/redis_om/model/model.py", line 1311, in __new__
    new_class = super().__new__(cls, name, bases, attrs, **kwargs)
  File "pydantic/main.py", line 282, in pydantic.main.ModelMetaclass.__new__
  File "/usr/lib/python3.10/abc.py", line 106, in __new__
    cls = super().__new__(mcls, name, bases, namespace, **kwargs)
  File.../site-packages/redis_om/model/model.py", line 1896, in __init_subclass__
    cls.redisearch_schema()
  File.../site-packages/redis_om/model/model.py", line 1965, in redisearch_schema
    schema_parts = [schema_prefix] + cls.schema_for_fields()
  File.../site-packages/redis_om/model/model.py", line 1983, in schema_for_fields
    fields[name] = PydanticFieldInfo.from_annotation(field)
AttributeError: type object 'FieldInfo' has no attribute 'from_annotation'

It works for redis-om 0.3.1 so the issue was introduced in 0.3.2.

@XChikuX
Copy link

XChikuX commented Sep 4, 2024

@slorello89 Same issue I ran into for my v1 project.

@areski
Copy link

areski commented Sep 5, 2024

Same issue too!

@dearkafka
Copy link

same issue!

@SteniMariyaThomas
Copy link

same issue

@dearkafka
Copy link

great job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants