diff --git a/src/commands/index.ts b/src/commands/index.ts index 86fa97834..79b5f92e4 100644 --- a/src/commands/index.ts +++ b/src/commands/index.ts @@ -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 || {}; @@ -452,6 +462,9 @@ export class VSCodeCommands implements Disposable { const dbtIntegrationMode = workspace .getConfiguration("dbt") .get("dbtIntegration", "core"); + const allowListFolders = workspace + .getConfiguration("dbt") + .get("allowListFolders", []); this.dbtTerminal.logBlock([ `Python Path=${this.pythonEnvironment.pythonPath}`, `VSCode version=${version}`, @@ -461,6 +474,7 @@ export class VSCodeCommands implements Disposable { }`, `DBT integration mode=${dbtIntegrationMode}`, `First workspace path=${getFirstWorkspacePath()}`, + `AllowList Folders=${allowListFolders}`, ]); this.dbtTerminal.logNewLine(); diff --git a/src/dbt_client/index.ts b/src/dbt_client/index.ts index 95486c5cb..708f63b35 100644 --- a/src/dbt_client/index.ts +++ b/src/dbt_client/index.ts @@ -112,6 +112,16 @@ export class DBTClient implements Disposable { } return false; } + if (!this.pythonEnvironment.isPython3) { + const answer = await window.showErrorMessage( + "Only Python 3 is supported by dbt, please select a Python 3 interpreter", + PythonInterpreterPromptAnswer.SELECT, + ); + if (answer === PythonInterpreterPromptAnswer.SELECT) { + commands.executeCommand("python.setInterpreter"); + } + return false; + } return this.showErrorIfDbtIsNotInstalled(); } diff --git a/src/manifest/pythonEnvironment.ts b/src/manifest/pythonEnvironment.ts index ccd038e3f..5da01788c 100755 --- a/src/manifest/pythonEnvironment.ts +++ b/src/manifest/pythonEnvironment.ts @@ -17,6 +17,8 @@ export class PythonEnvironment implements Disposable { private executionDetails?: PythonExecutionDetails; private disposables: Disposable[] = []; private environmentVariableSource: Record = {}; + public allPythonPaths: { path: string; pathType: string }[] = []; + public isPython3: boolean = true; constructor( private telemetry: TelemetryService, private commandProcessExecutionFactory: CommandProcessExecutionFactory, @@ -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