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

Can't find the sqlfluff.exe file after installation #133

Open
BartWinterCoolblue opened this issue Apr 16, 2024 · 6 comments
Open

Can't find the sqlfluff.exe file after installation #133

BartWinterCoolblue opened this issue Apr 16, 2024 · 6 comments

Comments

@BartWinterCoolblue
Copy link

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?

@perlego-maares
Copy link

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.

@aaronclong
Copy link

What if sqlfluff is installed by poetry or in other virtual env in python? Is there a way to have it detect that?

@perlego-maares
Copy link

perlego-maares commented Jun 7, 2024

@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.

@aaronclong
Copy link

aaronclong commented Jun 8, 2024

@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.

If you aren't familiar with Python virtual environments, this article should cover it "Python Virtual Environments Explained with Examples".

The suggestion to simply add it to the PATH on each Vscode load is rather burdensome and manual.

@aaronclong
Copy link

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.

image
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)
  });
});

@aaronclong
Copy link

@perlego-maares what are your thoughts on the above?^

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

3 participants