Open BartWinterCoolblue opened 4 months ago
Hi @BartWinterCoolblue, the vscode extension does not install sqlFluff on your local, it just use it. Please do have a look at the readme file
quote:
Configuration
The extension expects sqlfluff to be installed and already added to the path. If it is installed but cannot be found, add the path to your preferences as seen below. Find the path by typing which sqlfluff into your terminal.
What if sqlfluff is installed by poetry or in other virtual env in python? Is there a way to have it detect that?
@aaronclong independently of the how is installed, either local or v. env, when performing cmd such as “which sqlfluff” once installed should recover the path, if still is not found add it to the shell paths:
echo $PATH
include the path in which sqlfluff is included into $PATH
while also add the executable path in your setting.json from your profile used in vscode.
"sqlfluff.executablePath": "/Library/Frameworks/Python.framework/Versions/X.XX/bin/sqlfluff”
Not quite follow the issue, maybe adding console error details will help.
@perlego-maares so their isn't one install of sqlfluff but installed in virtual environment that will change depending on the project/repo.
In addition putting the hardcode coded path there makes the config completely unusable for teams/multiple contributors.
The suggestion to simply add it to the PATH
on each Vscode load is rather burdensome and manual.
It would be nice if the config could specify a dependencyManager
and directory. The extension could load this.
settings.json
"sqlfluff.dependencyManager": "poetry",
"sqlfluff.projectRoot": "${workspace}/path"
Then the linter provider could spawn a child process and get exec from there.
With poetry, you can dynamically fetch the path from this poetry run which sqlfluff
.
const { exec } = require('child_process');
return new Promise((resolve, reject) => {
exec('poetry run which sqlfluff', (error, stdout, stderr) => {
if (error || stderr) {
reject(error || stderr);
return;
}
resolve(stdout)
});
});
@perlego-maares what are your thoughts on the above?^
Hi! I just installed the sqfluff extension in VScode. Unfortunately, I got the message that the sqlfluff executable was not found. 'which sqlfluff' is not working and I also don't see the file in any of my repositories. Does anyone how to solve this issue?