-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[CT-2733] [Regression] SQLFluff dbt templater fails with TypeError: cannot pickle 'ContextVar' object #7937
Comments
Thank you for a fantastic write-up @katieclaiborne 🤩 I haven't gone through the steps to reproduce this yet, but we'll give this a look and get back to you. We will specifically take a look at any downstream effects of ca73a2a. |
Thank you, Doug! |
Thanks so much for your attention to this issue! I will mention that it's blocking the next SQLFLuff release (which contains an unrelated security fix): sqlfluff/sqlfluff#4931 |
Thanks for calling out the effect that it is having on your next release @greg-finley. We don't have a firm timeline to fix and release this. In the meantime, would it be an option for |
If we don't have a project and hence a project_root, I presume we'd have to fallback to cwd. |
This actually doesn't have anything to do with the project_root. It's that multiprocessing needs to pickle the code and can't pickle ContextVars. |
It's been a very busy week... Could someone verify if the changes in #7949 fixes this issue? We don't use multiprocessing in our code... |
Hey @gshank yeah I tried testing this and it seems to do the job. We use redshift and I haven't tried testing this way before but I think it would work - basically running cloned versions of dbt-core and dbt-redshift, with dbt-core checked out to ct-2733-multiprocessing_contextvars and dbt-redshift checked out to main, and dbt-redshift repointed to install from the local checked out version of dbt-core (mostly just explaining this in case my methodology is bad). Screenshot with some output and SQLFluff did succeed with that. |
@gshank Similar to the positive report by @amardatar, this worked for me too ✅ DetailsFirst, using a branch from dbt-core
and also the error message reported in #7937:
Then I cherry-picked your commits into #7970 (resolving one small merge conflict along the way). With your changes, both of the following worked without error: sqlfluff lint models/my_model.sql
pre-commit run sqlfluff-lint --files models/my_model.sql |
Is this a new bug in dbt-core?
Current Behavior
When running with dbt-core v1.5.2, the
sqlfluff-lint
pre-commit hook fails with the type error below.Expected Behavior
I expected the hook to run successfully.
Steps To Reproduce
.pre-commit-config.yaml
file with the configuration below..sqlfluff
file with the configuration below..sqlfluffignore
file with the configuration below.Relevant log output
Environment
Which database adapter are you using with dbt?
bigquery
Additional Context
@MarcBook has opened a similar issue in the SQLFluff repo: sqlfluff/sqlfluff#4930
I agree with his assessment that ca73a2a may have caused this bug.
The text was updated successfully, but these errors were encountered: