Skip to content

Commit

Permalink
Merge pull request #60 from PrefectHQ/pydantic-v2-compatibility
Browse files Browse the repository at this point in the history
Conditional imports to support operating with `pydantic>2` installed
  • Loading branch information
chrisguidry authored Oct 4, 2023
2 parents 9079bbe + 164848f commit d1760bb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 7 additions & 1 deletion prefect_airbyte/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@
from prefect import get_run_logger, task
from prefect.blocks.abstract import JobBlock, JobRun
from prefect.utilities.asyncutils import sync_compatible
from pydantic import BaseModel, Field
from pydantic import VERSION as PYDANTIC_VERSION

if PYDANTIC_VERSION.startswith("2."):
from pydantic.v1 import BaseModel, Field
else:
from pydantic import BaseModel, Field

from typing_extensions import Literal

from prefect_airbyte import exceptions as err
Expand Down
7 changes: 6 additions & 1 deletion prefect_airbyte/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
from logging import Logger

from prefect.blocks.core import Block
from pydantic import Field, SecretStr
from pydantic import VERSION as PYDANTIC_VERSION

if PYDANTIC_VERSION.startswith("2."):
from pydantic.v1 import Field, SecretStr
else:
from pydantic import Field, SecretStr

from prefect_airbyte.client import AirbyteClient

Expand Down

0 comments on commit d1760bb

Please sign in to comment.