-
Notifications
You must be signed in to change notification settings - Fork 7
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
TypeError: BaseModel.validate() takes 2 positional arguments but 3 were given #61
Comments
Hi @radiatorius1024, which version of With |
Hi. Yes I have heard about the changes so the latest version is used: |
Thanks @radiatorius1024, I should have also asked: what version of |
Here are all installed libraries (Prefect installed on Docker, but same error with local installation):
aiobotocore==2.7.0 |
Thank you! We'll dig into this |
We have seen a few edge cases popping up where we're trying to use the pydantic v2 validator to validate v1 models as flow function arguments. This leads to the opaque error: ``` TypeError: BaseModel.validate() takes 2 positional arguments but 3 were given ``` Examples: * PrefectHQ/prefect-airbyte#61 * https://github.com/PrefectHQ/prefect-kubernetes/actions/runs/6628004996/job/18004160832?pr=92 The issue here is that we were trying to use our custom v2 port of the v1 `ValidatedFunction`, without inspecting the types of models involved. Here, we are looking at the types of the passed arguments, validating that they aren't mixing v1 and v2 models, and then choosing the right validation implementation from there.
Hi @radiatorius1024, thanks for the bug report, we believe we have corrected this in the latest Can you let us know if that corrected things for you? |
Everything works great now, thanks. |
Hey @chrisguidry I have been stuck on this same error for a while now. I am using a docker work-pool to run the flow (and subflow) that's stored locally. I was initially using Prefect Server and Connection blocks to maintain the Airbyte Connection information, but have since adjusted my script to match radiatorius', but I'm still getting the same error. Could it be the work-pool? Here are my specs:
|
Sorry about that, @jloehn! Can you paste the full exception you're seeing with the stack trace so we can see where it's happening for you? It may be the same error but manifesting from a different place. |
Hmm, if you've updated to python 3.11, is it possible this image itself is outdated? Are you able to easily modify this flow to print out some info from inside the container? Maybe something like:
from within the flow so we can see if maybe it's not running the latest versions? |
@chrisguidry Thanks for pointing me in the right direction. I kept overlooking the push section of my prefect.yaml. |
Nice! Glad to hear it's working! |
An error is received when executing flow in Prefect 2.13.7...2.13.8:
from prefect_airbyte.server import AirbyteServer
from prefect_airbyte.connections import AirbyteConnection
from prefect_airbyte.flows import run_connection_sync
server = AirbyteServer(server_host="192.168.1.126", server_port=8000)
connection = AirbyteConnection(
airbyte_server=server,
connection_id="b35180dc-6bd1-48b0-b0cd-b99deb6caaaa",
status_updates=True
)
@flow
def extract_data_subflow():
run_connection_sync(airbyte_connection=connection)
pydantic_self.pydantic_validator.validate_python(data, self_instance=pydantic_self)
TypeError: BaseModel.validate() takes 2 positional arguments but 3 were given
The text was updated successfully, but these errors were encountered: