Lee Mendelowitz
11/19/2023, 2:28 PMfrom typing import Optional
from prefect.blocks.core import Block
from pydantic import SecretStr
class AWSCredentials(Block):
aws_access_key_id: Optional[str] = None
aws_secret_access_key: Optional[SecretStr] = None
aws_session_token: Optional[str] = None
profile_name: Optional[str] = None
region_name: Optional[str] = None
RuntimeError: no validator found for <class 'pydantic.types.SecretStr'>, see `arbitrary_types_allowed` in Config
Anyone have any ideas? I know pinning pydantic<2
will make the error go away, but since Prefect supports pydantic 2 I’m trying to understand if this is a Prefect bug or if we need to do something differently with our blocks on pydantic 2.Alexander Azzam
11/19/2023, 2:52 PMLee Mendelowitz
11/19/2023, 2:56 PMAlexander Azzam
11/19/2023, 3:03 PMAlexander Azzam
11/19/2023, 3:03 PMLee Mendelowitz
11/19/2023, 3:46 PMfrom typing import Optional
from prefect.blocks.core import Block
try:
from pydantic.v1 import SecretStr
except ImportError:
from pydantic import SecretStr
class AWSCredentials(Block):
aws_access_key_id: Optional[str] = None
aws_secret_access_key: Optional[SecretStr] = None
aws_session_token: Optional[str] = None
profile_name: Optional[str] = None
region_name: Optional[str] = None
Alexander Azzam
11/19/2023, 3:57 PMLee Mendelowitz
11/19/2023, 3:59 PMpydantic.v1
and that will throw an import error if not on pydantic 2, but wasn’t sure if that was the best way to handle itAlexander Azzam
11/19/2023, 4:02 PM