-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Allow sqlfluff to be installed in a conda (or other) virtual environment #23
Comments
Running up against the same issue. Any ongoing work on this? |
The latest version (0.0.5) fixed the definition of the executable in |
@b-per, what do you mean by "when the path has been added manually"? because this still doesn't work for me. Would be very interested to know your |
So it seems this is working for me with this configuration.
Not sure why VScode settings found in {
"python.defaultInterpreterPath": "/opt/anaconda3/envs/surfline-dbt/bin/python",
} Hope this helps others. Thank you @dorzey and others for updates to the plugin 🙏🏽 . |
@GClunies It would be great if you could raise a PR with the anaconda setup so that I can link it from the README. I'm unfamiliar with anaconda myself. |
@dorzey I am still playing around with this a bit still, so excuse the "stream of consciousness" comments. But in general it seems like recent fixes are headed in the right direction! My
name: surfline-dbt
channels:
- conda-forge
- defaults
dependencies:
- agate=1.6.1
- pip=20.1.1
- python=3.8
- pip:
- dbt==0.19.1
- sqlfluff==0.5.3 # I plan to update this
{
"dbt.listModelsDisabled": true,
"files.associations": {
"*.sql": "jinja-sql",
"*.rmd": "markdown"
},
"[sql]": {
"breadcrumbs.showArrays": true,
"editor.insertSpaces": true,
"editor.tabSize": 4
},
"[jinja-sql]": {
"breadcrumbs.showArrays": true,
"editor.insertSpaces": true,
"editor.tabSize": 4,
},
"sql.linter.executablePath": "/opt/anaconda3/envs/surfline-dbt/bin/sqlfluff",
}
{
"python.defaultInterpreterPath": "/opt/anaconda3/envs/surfline-dbt/bin/python",
} I think that's the whole setup right now. I am still testing functionality still. It's a bit slow at returning linting errors when I save a file, but I suspect thats from the dbt-compiler having to run due to |
Thanks for this. I will try and find time to replicate your setup. |
I have the same issue where lint warnings are not showing up in the problems pane, but the formatting on save works??? I've tried clean installing, removing all my sqlfluff user settings, toggling them on/off. Here are my sql related settings:
Whats strange is the linting was working yesterday, and I had not changed any settings. So I have no clue why its not working today. I have the sqltools extension too but uninstalling that makes no difference either. I'm on vscode-sqlfluff v0.0.5 and sqlfluff 0.6.6. |
Somehow, I eventually had this working on a previous machine. New machine and I can't get the vscode extension to work. in the virtual environment: (env) % which sqlfluff .vscode/settings.json right click on a file, select 'format document' and I get: I wrote a note to myself last time that alternating between onType and onSave was enough to get it unstuck. Doesnt work this time. I would really appreciate more detailed docs for the setup. Willing to help. |
I'm having a similar issue with using vscode-sqlfluff in an conda virtual environment. The below error message shows up:
I've added the below to .vscode/settings.json within project: And I've also added the below to user settings: Conda Environment
|
Issue:
As alluded to by @pwildenhain in this slack thread, it seems this extension only works if
sqlfluff
is installed globally. It does not seem to recognizesqlfluff
when it is installed in a virtual environment.I have
sqlfluff
installed in a conda virtual environment and I don’t get ANY feedback in VScode that the sqlfluff extension is working even though the extension is installed and enabled. I see no linting hints like in the demo shown in this repo. I am able to runsqlfluff
from the terminal so I do know it is installed and works.I have
python
,dbt
, andsqlfluff
installed via aconda
virtual environment (and virtual env is activated in VScode). The conda env is defined as:Path to
sqlfluff
isI have the path to
sqlfluff
specified in my VScodesettings.json
like:Expected Behavior:
sqlfluff extension should be able to use
sqlfluff
from the conda environment, or any other virtual environment that is active in VScode.Possible Solutions:
While I am not familiar with the code structure for VScode extensions, I do know that the dbt Power user VSCode extension is able to recognize
dbt
when it is installed in aconda
environment. Maybe a similar approach could be used here? It looks like the important files for recognizing the virtual environment are listed here: https://github.com/innoverio/vscode-dbt-power-user/search?q=environmentThe text was updated successfully, but these errors were encountered: