From ba694a05585fb1124d4e4f4433562578fc08eaeb Mon Sep 17 00:00:00 2001 From: Cheena Malhotra <13396919+cheenamalhotra@users.noreply.github.com> Date: Tue, 18 Apr 2023 22:07:02 -0700 Subject: [PATCH] Register mysql, pgsql with mssql as default 'sql' kernel providers (#22729) --- src/sql/platform/connection/common/constants.ts | 1 + src/sql/workbench/services/notebook/browser/interfaces.ts | 4 +++- .../services/notebook/browser/models/notebookModel.ts | 2 +- .../services/notebook/browser/notebookServiceImpl.ts | 6 +++++- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/sql/platform/connection/common/constants.ts b/src/sql/platform/connection/common/constants.ts index 191e57ee2a..5419e89a7c 100644 --- a/src/sql/platform/connection/common/constants.ts +++ b/src/sql/platform/connection/common/constants.ts @@ -11,6 +11,7 @@ export const outputChannelName = 'MSSQL'; export const capabilitiesOptions = 'OPTIONS_METADATA'; export const mssqlProviderName = 'MSSQL'; +export const mysqlProviderName = 'MYSQL'; export const pgsqlProviderName = 'PGSQL'; export const anyProviderName = '*'; export const connectionProviderContextKey = 'connectionProvider'; diff --git a/src/sql/workbench/services/notebook/browser/interfaces.ts b/src/sql/workbench/services/notebook/browser/interfaces.ts index fb33308585..e8a428b050 100644 --- a/src/sql/workbench/services/notebook/browser/interfaces.ts +++ b/src/sql/workbench/services/notebook/browser/interfaces.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { nb } from 'azdata'; -import { mssqlProviderName } from 'sql/platform/connection/common/constants'; +import { mssqlProviderName, mysqlProviderName, pgsqlProviderName } from 'sql/platform/connection/common/constants'; import { localize } from 'vs/nls'; export interface FutureInternal extends nb.IFuture { @@ -14,6 +14,8 @@ export interface FutureInternal extends nb.IFuture { export namespace notebookConstants { export const SQL = 'SQL'; export const SQL_CONNECTION_PROVIDER = mssqlProviderName; + export const MYSQL_CONNECTION_PROVIDER = mysqlProviderName; + export const PGSQL_CONNECTION_PROVIDER = pgsqlProviderName; export const sqlKernel: string = localize('sqlKernel', "SQL"); export const sqlKernelSpec: nb.IKernelSpec = ({ name: sqlKernel, diff --git a/src/sql/workbench/services/notebook/browser/models/notebookModel.ts b/src/sql/workbench/services/notebook/browser/models/notebookModel.ts index fedcd49536..4a17840ac9 100644 --- a/src/sql/workbench/services/notebook/browser/models/notebookModel.ts +++ b/src/sql/workbench/services/notebook/browser/models/notebookModel.ts @@ -1121,7 +1121,7 @@ export class NotebookModel extends Disposable implements INotebookModel { // Switching from Kusto to another kernel should set the currentKernelAlias to undefined if (this._selectedKernelDisplayName !== this._currentKernelAlias && this._selectedKernelDisplayName) { this._currentKernelAlias = undefined; - } else { + } else if (this._currentKernelAlias) { // Adds Kernel Alias and Connection Provider to Map if new Notebook connection contains notebookKernelAlias this._kernelDisplayNameToConnectionProviderIds.set(this._currentKernelAlias, [profile.providerName]); } diff --git a/src/sql/workbench/services/notebook/browser/notebookServiceImpl.ts b/src/sql/workbench/services/notebook/browser/notebookServiceImpl.ts index f4c0245d95..ca598697b8 100644 --- a/src/sql/workbench/services/notebook/browser/notebookServiceImpl.ts +++ b/src/sql/workbench/services/notebook/browser/notebookServiceImpl.ts @@ -909,7 +909,11 @@ export class NotebookService extends Disposable implements INotebookService { standardKernels: [{ name: notebookConstants.SQL, displayName: notebookConstants.SQL, - connectionProviderIds: [notebookConstants.SQL_CONNECTION_PROVIDER], + connectionProviderIds: [ + notebookConstants.SQL_CONNECTION_PROVIDER, + notebookConstants.MYSQL_CONNECTION_PROVIDER, + notebookConstants.PGSQL_CONNECTION_PROVIDER + ], supportedLanguages: [notebookConstants.sqlKernelSpec.language] }] });