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

Flow does not allow the use of pydantic v1 SecretStr #15603

Closed
ConstantinoSchillebeeckx opened this issue Oct 7, 2024 · 1 comment · Fixed by #15608
Closed

Flow does not allow the use of pydantic v1 SecretStr #15603

ConstantinoSchillebeeckx opened this issue Oct 7, 2024 · 1 comment · Fixed by #15608
Labels
bug Something isn't working

Comments

@ConstantinoSchillebeeckx
Copy link
Contributor

ConstantinoSchillebeeckx commented Oct 7, 2024

Bug summary

When I try to use from pydantic.v1 import SecretStr as an input arg type to my flow I"m getting:

pydantic.errors.PydanticUserError: The `__modify_schema__` method is not supported in Pydantic v2. Use `__get_pydantic_json_schema__` instead in class `SecretStr`.

For example:

from typing import Any, Optional

from prefect import get_run_logger

from prefect import flow
from pydantic.v1 import SecretStr # works with from pydantic import SecretStr


@flow
def foo(token: Optional[SecretStr] = None) -> Any:
    logger = get_run_logger()
    logger.info(token)


foo()

Slack thread.

Version info (prefect version output)

Version:             2.20.6
API version:         0.8.4
Python version:      3.10.13
Git commit:          905bef9f
Built:               Thu, Sep 5, 2024 10:08 PM
OS/Arch:             darwin/arm64
Profile:             default
Server type:         cloud

Also
pydantic==2.9.2
pydantic_core==2.23.4

Additional context

No response

@zzstoatzz
Copy link
Collaborator

closed by #15608

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

Successfully merging a pull request may close this issue.

2 participants