Brian Newman
10/31/2023, 5:40 PMKevin Grismore
10/31/2023, 5:44 PMBrian Newman
10/31/2023, 5:45 PMKevin Grismore
10/31/2023, 5:47 PMBrian Newman
10/31/2023, 5:50 PMKevin Grismore
10/31/2023, 6:01 PMSecret
pydantic types, like SecretStr
.
from prefect import flow
from pydantic import SecretStr
@flow(log_prints=True)
def my_flow(name: str):
secretName = SecretStr(name)
my_subflow(secretName)
@flow(log_prints=True)
def my_subflow(secretName: SecretStr):
name = secretName.get_secret_value()
print(f"Hi {name} from the subflow!")
if __name__=="__main__":
my_flow("Kevin")
Running that results in an obfuscated value in the UI.merlin
11/02/2023, 11:08 PMSecretStr
type:
RuntimeError: no validator found for <class 'pydantic.types.SecretStr'>, see `arbitrary_types_allowed` in Config
My code worked fine before upgrading to Prefect 2.13.7 which is begin of Pydantic V2 support.Kevin Grismore
11/02/2023, 11:14 PMmerlin
11/03/2023, 2:42 AMmerlin
11/03/2023, 5:00 PMpoetry add pydantic="^1.10"
Upgrading to pydantic V2 across a package can be a chore, so I'm just putting that off.