mirror of
https://github.com/apache/superset.git
synced 2026-05-18 14:25:13 +00:00
Compare commits
1 Commits
db-upload-
...
supersetbo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca399ca86e |
@@ -111,7 +111,7 @@ athena = ["pyathena[pandas]>=2, <3"]
|
||||
aurora-data-api = ["preset-sqlalchemy-aurora-data-api>=0.2.8,<0.3"]
|
||||
bigquery = [
|
||||
"pandas-gbq>=0.19.1",
|
||||
"sqlalchemy-bigquery>=1.15.0",
|
||||
"sqlalchemy-bigquery>=1.6.1",
|
||||
"google-cloud-bigquery>=3.10.0",
|
||||
]
|
||||
clickhouse = ["clickhouse-connect>=0.5.14, <1.0"]
|
||||
|
||||
@@ -11,7 +11,9 @@ apispec==6.6.1
|
||||
apsw==3.50.1.0
|
||||
# via shillelagh
|
||||
async-timeout==4.0.3
|
||||
# via -r requirements/base.in
|
||||
# via
|
||||
# -r requirements/base.in
|
||||
# redis
|
||||
attrs==25.3.0
|
||||
# via
|
||||
# cattrs
|
||||
@@ -97,6 +99,11 @@ email-validator==2.2.0
|
||||
# via flask-appbuilder
|
||||
et-xmlfile==2.0.0
|
||||
# via openpyxl
|
||||
exceptiongroup==1.3.0
|
||||
# via
|
||||
# cattrs
|
||||
# trio
|
||||
# trio-websocket
|
||||
flask==2.3.3
|
||||
# via
|
||||
# apache-superset (pyproject.toml)
|
||||
@@ -154,6 +161,7 @@ greenlet==3.1.1
|
||||
# via
|
||||
# apache-superset (pyproject.toml)
|
||||
# shillelagh
|
||||
# sqlalchemy
|
||||
gunicorn==23.0.0
|
||||
# via apache-superset (pyproject.toml)
|
||||
h11==0.16.0
|
||||
@@ -229,7 +237,7 @@ nh3==0.2.21
|
||||
# via apache-superset (pyproject.toml)
|
||||
numexpr==2.10.2
|
||||
# via -r requirements/base.in
|
||||
numpy==1.26.4
|
||||
numpy==2.2.6
|
||||
# via
|
||||
# apache-superset (pyproject.toml)
|
||||
# bottleneck
|
||||
@@ -395,9 +403,11 @@ typing-extensions==4.14.0
|
||||
# apache-superset (pyproject.toml)
|
||||
# alembic
|
||||
# cattrs
|
||||
# exceptiongroup
|
||||
# limits
|
||||
# pyopenssl
|
||||
# referencing
|
||||
# rich
|
||||
# selenium
|
||||
# shillelagh
|
||||
tzdata==2025.2
|
||||
|
||||
@@ -20,6 +20,10 @@ apsw==3.50.1.0
|
||||
# shillelagh
|
||||
astroid==3.3.10
|
||||
# via pylint
|
||||
async-timeout==4.0.3
|
||||
# via
|
||||
# -c requirements/base.txt
|
||||
# redis
|
||||
attrs==25.3.0
|
||||
# via
|
||||
# -c requirements/base.txt
|
||||
@@ -176,6 +180,13 @@ et-xmlfile==2.0.0
|
||||
# via
|
||||
# -c requirements/base.txt
|
||||
# openpyxl
|
||||
exceptiongroup==1.3.0
|
||||
# via
|
||||
# -c requirements/base.txt
|
||||
# cattrs
|
||||
# pytest
|
||||
# trio
|
||||
# trio-websocket
|
||||
filelock==3.12.2
|
||||
# via virtualenv
|
||||
flask==2.3.3
|
||||
@@ -313,6 +324,7 @@ greenlet==3.1.1
|
||||
# apache-superset
|
||||
# gevent
|
||||
# shillelagh
|
||||
# sqlalchemy
|
||||
grpcio==1.71.0
|
||||
# via
|
||||
# apache-superset
|
||||
@@ -457,7 +469,7 @@ nh3==0.2.21
|
||||
# apache-superset
|
||||
nodeenv==1.8.0
|
||||
# via pre-commit
|
||||
numpy==1.26.4
|
||||
numpy==2.2.6
|
||||
# via
|
||||
# -c requirements/base.txt
|
||||
# apache-superset
|
||||
@@ -795,7 +807,7 @@ sqlalchemy==1.4.54
|
||||
# shillelagh
|
||||
# sqlalchemy-bigquery
|
||||
# sqlalchemy-utils
|
||||
sqlalchemy-bigquery==1.15.0
|
||||
sqlalchemy-bigquery==1.12.0
|
||||
# via apache-superset
|
||||
sqlalchemy-utils==0.38.3
|
||||
# via
|
||||
@@ -818,6 +830,11 @@ tabulate==0.9.0
|
||||
# via
|
||||
# -c requirements/base.txt
|
||||
# apache-superset
|
||||
tomli==2.2.1
|
||||
# via
|
||||
# coverage
|
||||
# pylint
|
||||
# pytest
|
||||
tomlkit==0.13.3
|
||||
# via pylint
|
||||
tqdm==4.67.1
|
||||
@@ -840,10 +857,13 @@ typing-extensions==4.14.0
|
||||
# -c requirements/base.txt
|
||||
# alembic
|
||||
# apache-superset
|
||||
# astroid
|
||||
# cattrs
|
||||
# exceptiongroup
|
||||
# limits
|
||||
# pyopenssl
|
||||
# referencing
|
||||
# rich
|
||||
# selenium
|
||||
# shillelagh
|
||||
tzdata==2025.2
|
||||
|
||||
@@ -50,7 +50,6 @@ const ExtraOptions = ({
|
||||
onExtraInputChange,
|
||||
onExtraEditorChange,
|
||||
extraExtension,
|
||||
testedEngineInfo,
|
||||
}: {
|
||||
db: DatabaseObject | null;
|
||||
onInputChange: (
|
||||
@@ -63,14 +62,13 @@ const ExtraOptions = ({
|
||||
) => void;
|
||||
onExtraEditorChange: Function;
|
||||
extraExtension: DatabaseConnectionExtension | undefined;
|
||||
testedEngineInfo?: any;
|
||||
}) => {
|
||||
const expandableModalIsOpen = !!db?.expose_in_sqllab;
|
||||
const createAsOpen = !!(db?.allow_ctas || db?.allow_cvas);
|
||||
// Use tested engine info if available, otherwise fall back to initial engine info
|
||||
const engineInfo = testedEngineInfo || db?.engine_information;
|
||||
const isFileUploadSupportedByEngine = engineInfo?.supports_file_upload;
|
||||
const supportsDynamicCatalog = engineInfo?.supports_dynamic_catalog;
|
||||
const isFileUploadSupportedByEngine =
|
||||
db?.engine_information?.supports_file_upload;
|
||||
const supportsDynamicCatalog =
|
||||
db?.engine_information?.supports_dynamic_catalog;
|
||||
|
||||
// JSON.parse will deep parse engine_params
|
||||
// if it's an object, and we want to keep it a string
|
||||
@@ -530,29 +528,23 @@ const ExtraOptions = ({
|
||||
/>
|
||||
</div>
|
||||
</StyledInputContainer>
|
||||
<StyledInputContainer
|
||||
css={!db?.allow_file_upload ? no_margin_bottom : {}}
|
||||
>
|
||||
<div className="input-container">
|
||||
<Checkbox
|
||||
id="allow_file_upload"
|
||||
name="allow_file_upload"
|
||||
indeterminate={false}
|
||||
checked={!!db?.allow_file_upload}
|
||||
disabled={!isFileUploadSupportedByEngine}
|
||||
onChange={onInputChange}
|
||||
>
|
||||
{t('Allow file uploads to database')}
|
||||
</Checkbox>
|
||||
{!isFileUploadSupportedByEngine && (
|
||||
<InfoTooltip
|
||||
tooltip={t(
|
||||
'File upload is not supported for this database engine'
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</StyledInputContainer>
|
||||
{isFileUploadSupportedByEngine && (
|
||||
<StyledInputContainer
|
||||
css={!db?.allow_file_upload ? no_margin_bottom : {}}
|
||||
>
|
||||
<div className="input-container">
|
||||
<Checkbox
|
||||
id="allow_file_upload"
|
||||
name="allow_file_upload"
|
||||
indeterminate={false}
|
||||
checked={!!db?.allow_file_upload}
|
||||
onChange={onInputChange}
|
||||
>
|
||||
{t('Allow file uploads to database')}
|
||||
</Checkbox>
|
||||
</div>
|
||||
</StyledInputContainer>
|
||||
)}
|
||||
{isFileUploadSupportedByEngine && !!db?.allow_file_upload && (
|
||||
<StyledInputContainer css={no_margin_bottom}>
|
||||
<div className="control-label">
|
||||
|
||||
@@ -607,7 +607,6 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
|
||||
const [editNewDb, setEditNewDb] = useState<boolean>(false);
|
||||
const [isLoading, setLoading] = useState<boolean>(false);
|
||||
const [testInProgress, setTestInProgress] = useState<boolean>(false);
|
||||
const [testedEngineInfo, setTestedEngineInfo] = useState<any>(null);
|
||||
const [passwords, setPasswords] = useState<Record<string, string>>({});
|
||||
const [sshTunnelPasswords, setSSHTunnelPasswords] = useState<
|
||||
Record<string, string>
|
||||
@@ -736,9 +735,6 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
|
||||
addSuccessToast(errorMsg);
|
||||
setHasValidated(true);
|
||||
},
|
||||
(engineInfo: any) => {
|
||||
setTestedEngineInfo(engineInfo);
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
@@ -801,7 +797,6 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
|
||||
setSSHTunnelPrivateKeyPasswords({});
|
||||
setConfirmedOverwrite(false);
|
||||
setUseSSHTunneling(undefined);
|
||||
setTestedEngineInfo(null);
|
||||
onHide();
|
||||
};
|
||||
|
||||
@@ -1776,7 +1771,6 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
|
||||
<ExtraOptions
|
||||
extraExtension={dbConfigExtraExtension}
|
||||
db={db as DatabaseObject}
|
||||
testedEngineInfo={testedEngineInfo}
|
||||
onInputChange={(
|
||||
e: CheckboxChangeEvent | React.ChangeEvent<HTMLInputElement>,
|
||||
) => {
|
||||
@@ -2026,7 +2020,6 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
|
||||
<ExtraOptions
|
||||
extraExtension={dbConfigExtraExtension}
|
||||
db={db as DatabaseObject}
|
||||
testedEngineInfo={testedEngineInfo}
|
||||
onInputChange={(e: CheckboxChangeEvent) => {
|
||||
const { target } = e;
|
||||
onChange(ActionType.InputChange, {
|
||||
|
||||
@@ -712,18 +712,14 @@ export const testDatabaseConnection = (
|
||||
connection: Partial<DatabaseObject>,
|
||||
handleErrorMsg: (errorMsg: string) => void,
|
||||
addSuccessToast: (arg0: string) => void,
|
||||
onEngineInfo?: (engineInfo: any) => void,
|
||||
) => {
|
||||
SupersetClient.post({
|
||||
endpoint: 'api/v1/database/test_connection/',
|
||||
body: JSON.stringify(connection),
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
}).then(
|
||||
(response) => {
|
||||
() => {
|
||||
addSuccessToast(t('Connection looks good!'));
|
||||
if (onEngineInfo && response?.json?.engine_information) {
|
||||
onEngineInfo(response.json.engine_information);
|
||||
}
|
||||
},
|
||||
createErrorHandler((errMsg: Record<string, string[] | string> | string) => {
|
||||
handleErrorMsg(t('ERROR: %s', parsedErrorMessage(errMsg)));
|
||||
|
||||
@@ -91,7 +91,7 @@ class TestConnectionDatabaseCommand(BaseCommand):
|
||||
|
||||
def run( # noqa: C901
|
||||
self,
|
||||
) -> Database: # pylint: disable=too-many-statements,too-many-branches
|
||||
) -> None: # pylint: disable=too-many-statements,too-many-branches
|
||||
self.validate()
|
||||
ex_str = ""
|
||||
ssh_tunnel = self._properties.get("ssh_tunnel")
|
||||
@@ -168,8 +168,6 @@ class TestConnectionDatabaseCommand(BaseCommand):
|
||||
action=get_log_connection_action("test_connection_success", ssh_tunnel),
|
||||
engine=database.db_engine_spec.__name__,
|
||||
)
|
||||
|
||||
return database
|
||||
|
||||
except (NoSuchModuleError, ModuleNotFoundError) as ex:
|
||||
event_logger.log_with_context(
|
||||
|
||||
@@ -1258,17 +1258,6 @@ class DatabaseRestApi(BaseSupersetModelRestApi):
|
||||
properties:
|
||||
message:
|
||||
type: string
|
||||
engine_information:
|
||||
type: object
|
||||
properties:
|
||||
supports_file_upload:
|
||||
type: boolean
|
||||
disable_ssh_tunneling:
|
||||
type: boolean
|
||||
supports_dynamic_catalog:
|
||||
type: boolean
|
||||
supports_oauth2:
|
||||
type: boolean
|
||||
400:
|
||||
$ref: '#/components/responses/400'
|
||||
422:
|
||||
@@ -1282,9 +1271,8 @@ class DatabaseRestApi(BaseSupersetModelRestApi):
|
||||
except ValidationError as error:
|
||||
return self.response_400(message=error.messages)
|
||||
try:
|
||||
database = TestConnectionDatabaseCommand(item).run()
|
||||
engine_information = database.db_engine_spec.get_public_information()
|
||||
return self.response(200, message="OK", engine_information=engine_information)
|
||||
TestConnectionDatabaseCommand(item).run()
|
||||
return self.response(200, message="OK")
|
||||
except (SSHTunnelingNotEnabledError, SSHTunnelDatabasePortError) as ex:
|
||||
return self.response_400(message=str(ex))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user