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

feat: diagnostics additional info and dbt install checks #1307

Merged
merged 6 commits into from
Jul 19, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: added python 3 check
  • Loading branch information
AdiGajbhiye committed Jul 16, 2024
commit 1bd5522a930f54241d3f3104d6dc5312d46b5bc3
10 changes: 10 additions & 0 deletions src/dbt_client/index.ts
Original file line number Diff line number Diff line change
@@ -112,6 +112,16 @@ export class DBTClient implements Disposable {
}
return false;
}
if (!this.pythonEnvironment.isPython3) {
const answer = await window.showErrorMessage(
"Extension only supports python 3. Select python 3 interpreter",
mdesmet marked this conversation as resolved.
Show resolved Hide resolved
PythonInterpreterPromptAnswer.SELECT,
);
if (answer === PythonInterpreterPromptAnswer.SELECT) {
commands.executeCommand("python.setInterpreter");
}
return false;
}
return this.showErrorIfDbtIsNotInstalled();
}

5 changes: 5 additions & 0 deletions src/manifest/pythonEnvironment.ts
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ export class PythonEnvironment implements Disposable {
private disposables: Disposable[] = [];
private environmentVariableSource: Record<string, EnvFrom> = {};
public allPythonPaths: { path: string; pathType: string }[] = [];
public isPython3: boolean = true;
constructor(
private telemetry: TelemetryService,
private commandProcessExecutionFactory: CommandProcessExecutionFactory,
@@ -119,6 +120,10 @@ export class PythonEnvironment implements Disposable {

const api = extension.exports;
this.allPythonPaths = await api.environment.getEnvironmentPaths();
const pythonPath = api.settings.getExecutionDetails(workspace.workspaceFile)
.execCommand[0];
const envDetails = await api.environment.getEnvironmentDetails(pythonPath);
this.isPython3 = envDetails.version[0] === "3";

const dbtInstalledPythonPath: string[] = [];
// TODO: support multiple workspacefolders for python detection
Loading