diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm.tsx index e2a3f0338daae..0fdcd833fd946 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm.tsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm.tsx @@ -51,6 +51,9 @@ export const FormFieldOrder = [ 'catalog', 'query', 'encryption', + 'account', + 'warehouse', + 'role', ]; interface FieldPropTypes { @@ -432,6 +435,71 @@ const queryField = ({ /> ); +const warehouseField = ({ + required, + changeMethods, + getValidation, + validationErrors, + db, +}: FieldPropTypes) => ( + +); + +const roleField = ({ + required, + changeMethods, + getValidation, + validationErrors, + db, +}: FieldPropTypes) => ( + +); + +const accountField = ({ + required, + changeMethods, + getValidation, + validationErrors, + db, +}: FieldPropTypes) => ( + +); + const forceSSLField = ({ isEditMode, changeMethods, @@ -473,6 +541,9 @@ const FORM_FIELD_MAP = { encryption: forceSSLField, credentials_info: CredentialsInfo, catalog: TableCatalog, + warehouse: warehouseField, + role: roleField, + account: accountField, }; const DatabaseConnectionForm = ({ diff --git a/superset-frontend/src/views/CRUD/data/database/types.ts b/superset-frontend/src/views/CRUD/data/database/types.ts index d473ba50aac7c..4687b9e7050e9 100644 --- a/superset-frontend/src/views/CRUD/data/database/types.ts +++ b/superset-frontend/src/views/CRUD/data/database/types.ts @@ -47,6 +47,9 @@ export type DatabaseObject = { credentials_info?: string; query?: Record; catalog?: Record; + warehouse?: string; + role?: string; + account?: string; }; configuration_method: CONFIGURATION_METHOD; engine?: string; diff --git a/superset/db_engine_specs/snowflake.py b/superset/db_engine_specs/snowflake.py index fa31c2394ef39..b33aa6c6f32e3 100644 --- a/superset/db_engine_specs/snowflake.py +++ b/superset/db_engine_specs/snowflake.py @@ -16,6 +16,7 @@ # under the License. import json import re +import urllib from datetime import datetime from typing import Any, Dict, List, Optional, Pattern, Tuple, TYPE_CHECKING, TypedDict from urllib import parse @@ -25,7 +26,8 @@ from babel.core import default_locale from flask_babel import gettext as __ from marshmallow import fields, Schema -from sqlalchemy.engine.url import URL +from marshmallow.exceptions import ValidationError +from sqlalchemy.engine.url import make_url, URL from superset.db_engine_specs.postgres import PostgresBaseEngineSpec from superset.errors import SupersetError, SupersetErrorType @@ -211,7 +213,6 @@ def get_parameters_from_uri( cls, uri: str, encrypted_extra: Optional[Dict[str, str]] = None ) -> Any: value = make_url(uri) - # Building parameters from encrypted_extra and uri if encrypted_extra: return {**encrypted_extra, "query": value.query}