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

Pin / patch pydantic v2 #723

Closed
poudrouxj opened this issue Jul 3, 2023 · 2 comments · Fixed by #724
Closed

Pin / patch pydantic v2 #723

poudrouxj opened this issue Jul 3, 2023 · 2 comments · Fixed by #724

Comments

@poudrouxj
Copy link

poudrouxj commented Jul 3, 2023

Context

Breaking change in the latest pydantic release, would be nice to either pin / patch (preferably) pydantic :
https://docs.pydantic.dev/latest/migration/

Logs

Run spectacles content -v --project MY_PROJECT --incremental --exclude-personal --commit-ref MY_COMMIT_REF
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.9.17/x64/bin/spectacles", line 5, in <module>
    from spectacles.cli import main
  File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/spectacles/cli.py", line [15](https://github.com/REPO_REDACTED, in <module>
    from spectacles.runner import Runner
  File "/opt/hostedtoolcache/Python/3.9.[17](https://github.com/REPO_REDACTED#step:5:18)/x64/lib/python3.9/site-packages/spectacles/runner.py", line 3, in <module>
    from spectacles.exceptions import LookerApiError, SqlError
  File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/spectacles/exceptions.py", line 3, in <module>
    from spectacles.utils import details_from_http_error
  File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/spectacles/utils.py", line 9, in <module>
    from spectacles.types import T
  File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/spectacles/types.py", line 54, in <module>
    class ErrorQueryResult(BaseModel):
  File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/spectacles/types.py", line 55, in ErrorQueryResult
    class ErrorData(BaseModel):
  File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pydantic/_internal/_model_construction.py", line 95, in __new__
    private_attributes = inspect_namespace(
  File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pydantic/_internal/_model_construction.py", line 3[28](https://github.com/kolonialno/lookml-models/actions/runs/5442766289/jobs/9898435687#step:5:29), in inspect_namespace
    raise PydanticUserError(
pydantic.errors.PydanticUserError: A non-annotated attribute was detected: `runtime = 0.0`. All model fields require a type annotation; if `runtime` is not meant to be a field, you may be able to resolve this error by annotating it as a `ClassVar` or updating `model_config['ignored_types']`.
@adityasingh02
Copy link

Probably the same root cause with a different stack trace

Traceback (most recent call last):
  File "/home/circleci/.pyenv/versions/3.10.0/bin/spectacles", line 5, in <module>
    from spectacles.cli import main
  File "/home/circleci/.pyenv/versions/3.10.0/lib/python3.10/site-packages/spectacles/cli.py", line 15, in <module>
    from spectacles.runner import Runner
  File "/home/circleci/.pyenv/versions/3.10.0/lib/python3.10/site-packages/spectacles/runner.py", line 3, in <module>
    from spectacles.exceptions import LookerApiError, SqlError
  File "/home/circleci/.pyenv/versions/3.10.0/lib/python3.10/site-packages/spectacles/exceptions.py", line 3, in <module>
    from spectacles.utils import details_from_http_error
  File "/home/circleci/.pyenv/versions/3.10.0/lib/python3.10/site-packages/spectacles/utils.py", line 9, in <module>
    from spectacles.types import T
  File "/home/circleci/.pyenv/versions/3.10.0/lib/python3.10/site-packages/spectacles/types.py", line 90, in <module>
    class QueryResult(BaseModel):
  File "/home/circleci/.pyenv/versions/3.10.0/lib/python3.10/site-packages/pydantic/_internal/_model_construction.py", line 95, in __new__
    private_attributes = inspect_namespace(
  File "/home/circleci/.pyenv/versions/3.10.0/lib/python3.10/site-packages/pydantic/_internal/_model_construction.py", line 279, in inspect_namespace
    raise TypeError("To define root models, use `pydantic.RootModel` rather than a field called '__root__'")
TypeError: To define root models, use `pydantic.RootModel` rather than a field called '__root__'

@DylanBaker DylanBaker mentioned this issue Jul 3, 2023
5 tasks
@DylanBaker
Copy link
Collaborator

Spectacles v2.3.14 has now been deployed. It pins Pydantic to V1. We will revisit this shortly to migrate to Pydantic V2.

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.

3 participants