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
Show file tree
Hide file tree
Changes from 4 commits
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
14 changes: 14 additions & 0 deletions src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,16 @@ export class VSCodeCommands implements Disposable {
);
this.dbtTerminal.logNewLine();

// Printing env vars
this.dbtTerminal.logBlockWithHeader(
[
"Printing all python paths...",
"* Please remove any sensitive information before sending it to us",
],
this.pythonEnvironment.allPythonPaths.map(({ path }) => path),
);
this.dbtTerminal.logNewLine();

// Printing extension settings
const dbtSettings = workspace.getConfiguration().inspect("dbt");
const globalValue: any = dbtSettings?.globalValue || {};
Expand Down Expand Up @@ -452,6 +462,9 @@ export class VSCodeCommands implements Disposable {
const dbtIntegrationMode = workspace
.getConfiguration("dbt")
.get<string>("dbtIntegration", "core");
const allowListFolders = workspace
.getConfiguration("dbt")
.get<string[]>("allowListFolders", []);
this.dbtTerminal.logBlock([
`Python Path=${this.pythonEnvironment.pythonPath}`,
`VSCode version=${version}`,
Expand All @@ -461,6 +474,7 @@ export class VSCodeCommands implements Disposable {
}`,
`DBT integration mode=${dbtIntegrationMode}`,
`First workspace path=${getFirstWorkspacePath()}`,
`AllowList Folders=${allowListFolders}`,
]);
this.dbtTerminal.logNewLine();

Expand Down
10 changes: 10 additions & 0 deletions src/dbt_client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
7 changes: 7 additions & 0 deletions src/manifest/pythonEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export class PythonEnvironment implements Disposable {
private executionDetails?: PythonExecutionDetails;
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,
Expand Down Expand Up @@ -117,6 +119,11 @@ export class PythonEnvironment implements Disposable {
await extension.exports.ready;

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
Expand Down
Loading