This will fix #97 - I encountered the same problems when I needed to upgrade to Pydantic v2 in my DBT project.
Two changes are required to effect the migration:
First, I have removed the import of PydanticValueError, which no longer exists. I don't think any special functionality was provided by this import, and my sense is that the Pydantic... errors are for their internal use (the errors codes are now hardwired into ErrorCodes, a Literal, and don't seem to encourage custom use as previously in dbt2looker. Therefore the custom error is now derived from ValueError and should produce the same output message if a specific adaptor is not supported.
Secondly, Optional fields are now handled differently. I have given a default value of None to all the ones that had no default value, which should be behaviour-preserving (value doesn't have to be supplied and doesn't have a 'special' default value).
I tested it on my own DBT project to verify that nothing unexpected happens.
This will fix #97 - I encountered the same problems when I needed to upgrade to Pydantic v2 in my DBT project.
Two changes are required to effect the migration:
First, I have removed the import of
PydanticValueError
, which no longer exists. I don't think any special functionality was provided by this import, and my sense is that thePydantic...
errors are for their internal use (the errors codes are now hardwired intoErrorCodes
, aLiteral
, and don't seem to encourage custom use as previously indbt2looker
. Therefore the custom error is now derived fromValueError
and should produce the same output message if a specific adaptor is not supported.Secondly,
Optional
fields are now handled differently. I have given a default value ofNone
to all the ones that had no default value, which should be behaviour-preserving (value doesn't have to be supplied and doesn't have a 'special' default value).I tested it on my own DBT project to verify that nothing unexpected happens.
IMPORTANT NOTE
Naturally I need to keep my own fork of the project operational. Therefore this PR is built on top of my stack of open PRs. It is the fourth in the stack. Reviewers should review only the most recent commit.