You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Title: Migration Issues with Pydantic 2.x and BigQuery Class Improvements
Description
I encountered an issue when upgrading to Pydantic 2.x. Below is a code snippet that can be used as a patch:
defproject_id_exists(cls, v, values, **kwargs):
ifvandnotvalues.data.get("project_id"):
raiseValueError("Please specify project_id if billing_project_id is specified")
returnv
Problem Details
Pydantic Validator Update:
When using Pydantic 2.x, the method project_id_exists seems to cause issues due to changes in how validators are expected to handle values. This needs to be re-evaluated to conform to the new Pydantic standards.
BigQuery Class Refactoring:
Default Timeout Issue: Currently, the default timeout setting cannot be specified outside of the _execute_query methods. This limitation means that a job throws a "job canceled" exception if it runs longer than 30 minutes. There should be a way to specify a customizable timeout at a class or method level.
Billing Project Misuse: The billing project configuration is not appropriately used. The billing project ID should not replace the project_id. The project_id is meant for storage purposes, while the billing project ID is intended for switching computation resources. Generating the queries for the point in time joins and executing the them should use different clients initialized from both project_id and billing_project_id
Proposed Solution
Pydantic Validator Adjustment:
Ensure compatibility with Pydantic 2.x by updating the validator function to handle values appropriately according to the new guidelines.
BigQuery Class Improvement:
Implement a mechanism to allow specifying a default timeout at a more granular level than just at _execute_query.
Separate the responsibilities of project_id and billing_project_id to align with their intended purposes without interchanging their roles.
Title: Migration Issues with Pydantic 2.x and BigQuery Class Improvements
Description
I encountered an issue when upgrading to Pydantic 2.x. Below is a code snippet that can be used as a patch:
Problem Details
Pydantic Validator Update:
project_id_exists
seems to cause issues due to changes in how validators are expected to handlevalues
. This needs to be re-evaluated to conform to the new Pydantic standards.BigQuery Class Refactoring:
Default Timeout Issue: Currently, the default timeout setting cannot be specified outside of the
_execute_query
methods. This limitation means that a job throws a "job canceled" exception if it runs longer than 30 minutes. There should be a way to specify a customizable timeout at a class or method level.Billing Project Misuse: The billing project configuration is not appropriately used. The billing project ID should not replace the
project_id
. Theproject_id
is meant for storage purposes, while the billing project ID is intended for switching computation resources. Generating the queries for the point in time joins and executing the them should use different clients initialized from both project_id and billing_project_idProposed Solution
Pydantic Validator Adjustment:
BigQuery Class Improvement:
_execute_query
.project_id
andbilling_project_id
to align with their intended purposes without interchanging their roles.Environment
similar issues raised
pydantic issue in validator: #4678
FYI @breno-costa
The text was updated successfully, but these errors were encountered: