Skip to content
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

Just started following tutorial in https://art049.github.io/odmantic/ and an error #371

Open
kennarddh opened this issue Oct 9, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@kennarddh
Copy link

Bug

Traceback (most recent call last):
  File "D:\-\__init__.py", line 1, in <module>
    from odmantic import AIOEngine
  File "D:\-\venv\Lib\site-packages\odmantic\__init__.py", line 1, in <module>
    from .bson import ObjectId
  File "D:\-\venv\Lib\site-packages\odmantic\bson.py", line 11, in <module>
    from pydantic.datetime_parse import parse_datetime
  File "D:\-\venv\Lib\site-packages\pydantic\_migration.py", line 300, in wrapper
    raise PydanticImportError(f'`{import_path}` has been removed in V2.')
pydantic.errors.PydanticImportError: `pydantic.datetime_parse:parse_datetime` has been removed in V2.

Current Behavior

Follow https://art049.github.io/odmantic/

Expected behavior

It should not throw error

Environment

  • ODMantic version: 0.9.2
  • MongoDB version: 6.0.1
  • Pydantic infos (output of python -c "import pydantic.utils; print(pydantic.utils.version_info())):
D:\-\venv\Lib\site-packages\pydantic\_migration.py:281: UserWarning: `pydantic.utils:version_info` has been moved to `pydantic.versio
n:version_info`.
  warnings.warn(f'`{import_path}` has been moved to `{new_location}`.')
             pydantic version: 2.4.2
        pydantic-core version: 2.10.1
          pydantic-core build: profile=release pgo=false
                 install path: D:\-\venv\Lib\site-packages\pydantic
               python version: 3.11.5 (tags/v3.11.5:cce6ba9, Aug 24 2023, 14:38:34) [MSC v.1936 64 bit (AMD64)]
                     platform: Windows-10-10.0.19045-SP0
             related packages: typing_extensions-4.8.0
  • Version of additional modules (if relevant):
    • ...

Additional context

Add any other context about the problem here.

@kennarddh kennarddh added the bug Something isn't working label Oct 9, 2023
@vkrasnici
Copy link

@kennarddh that's because Pydantic V2 has removed parse_datetime which is required for the BSON encoder. Now, we should wait for either @art049 or any other maintainer (I don't mind doing it) to either create a custom parser or effectively import that same one from pydantic, which has also been forked from Django

@kennarddh
Copy link
Author

Ok but idk now i use other odm beanie...

@romain-pfund
Copy link

Add support for Pydantic V2 #359

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants