Skip to content
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

Env var required but not provided: DBT_USER error #74

Open
cmarche2ti opened this issue Nov 4, 2022 · 4 comments
Open

Env var required but not provided: DBT_USER error #74

cmarche2ti opened this issue Nov 4, 2022 · 4 comments
Assignees

Comments

@cmarche2ti
Copy link

I am having an issue with sqlfluff in vscode using a docker container. We get an error that the Env var required but not provided: 'DBT_SCHEMA' on save of a file but sqlfluff fix runs.

@RobertOstermann RobertOstermann self-assigned this Nov 14, 2022
@RobertOstermann
Copy link
Contributor

@cmarche2ti Interesting that fix would work but lint would fail. What are you configuration settings for this extension? Does changing sqlfluff.linter.run to onSave solve the problem?

@RobertOstermann
Copy link
Contributor

@cmarche2ti You could also try v2.0.1 and see if that fixes the problem for you. It should pass in the environment variables to the child processes and if you need to manually pass in a variable you can do it with the sqlfluff.environmentVariables setting.

@cmarche2ti
Copy link
Author

cmarche2ti commented Nov 22, 2022

@RobertOstermann Thanks for responding. I tried both of the above to fix and neither has or maybe that issue is fixed and I have a new one.
from sqlfluff.core.templaters.base import TemplatedFile, large_file_check ImportError: cannot import name 'large_file_check' from 'sqlfluff.core.templaters.base' (/home/vscode/.cache/pre-commit/repo88sww08w/py_env-python3.8/lib/python3.8/site-packages/sqlfluff/core/templaters/base.py)

@RobertOstermann
Copy link
Contributor

@cmarche2ti I honestly have never used this extension in a docker container so not entirely sure if it is possible/how well it would work. The way the extension works is it spawns a child process and passes the contents of the file to the sqlfluff command through stdin. With sqlfluff.linter.run = "onSave" that lets the command use the path of the file instead of the file contents. There is a sqlfluff output channel in the OUTPUT tab, could you check that tab and see exactly what command is being called. Copy that command and try running it in your terminal and what the output is if that happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants