mirror of
https://github.com/apache/superset.git
synced 2026-05-30 12:49:17 +00:00
chore(Databricks): New Databricks driver (#28393)
This commit is contained in:
@@ -116,6 +116,69 @@ export const databaseField = ({
|
||||
helpText={t('Copy the name of the database you are trying to connect to.')}
|
||||
/>
|
||||
);
|
||||
export const defaultCatalogField = ({
|
||||
required,
|
||||
changeMethods,
|
||||
getValidation,
|
||||
validationErrors,
|
||||
db,
|
||||
}: FieldPropTypes) => (
|
||||
<ValidatedInput
|
||||
id="default_catalog"
|
||||
name="default_catalog"
|
||||
required={required}
|
||||
value={db?.parameters?.default_catalog}
|
||||
validationMethods={{ onBlur: getValidation }}
|
||||
errorMessage={validationErrors?.default_catalog}
|
||||
placeholder={t('e.g. hive_metastore')}
|
||||
label={t('Default Catalog')}
|
||||
onChange={changeMethods.onParametersChange}
|
||||
helpText={t('The default catalog that should be used for the connection.')}
|
||||
/>
|
||||
);
|
||||
export const defaultSchemaField = ({
|
||||
required,
|
||||
changeMethods,
|
||||
getValidation,
|
||||
validationErrors,
|
||||
db,
|
||||
}: FieldPropTypes) => (
|
||||
<ValidatedInput
|
||||
id="default_schema"
|
||||
name="default_schema"
|
||||
required={required}
|
||||
value={db?.parameters?.default_schema}
|
||||
validationMethods={{ onBlur: getValidation }}
|
||||
errorMessage={validationErrors?.default_schema}
|
||||
placeholder={t('e.g. default')}
|
||||
label={t('Default Schema')}
|
||||
onChange={changeMethods.onParametersChange}
|
||||
helpText={t('The default schema that should be used for the connection.')}
|
||||
/>
|
||||
);
|
||||
export const httpPathField = ({
|
||||
required,
|
||||
changeMethods,
|
||||
getValidation,
|
||||
validationErrors,
|
||||
db,
|
||||
}: FieldPropTypes) => {
|
||||
console.error(db);
|
||||
return (
|
||||
<ValidatedInput
|
||||
id="http_path_field"
|
||||
name="http_path_field"
|
||||
required={required}
|
||||
value={db?.parameters?.http_path_field}
|
||||
validationMethods={{ onBlur: getValidation }}
|
||||
errorMessage={validationErrors?.http_path}
|
||||
placeholder={t('e.g. sql/protocolv1/o/12345')}
|
||||
label="HTTP Path"
|
||||
onChange={changeMethods.onParametersChange}
|
||||
helpText={t('Copy the name of the HTTP Path of your cluster.')}
|
||||
/>
|
||||
);
|
||||
};
|
||||
export const usernameField = ({
|
||||
required,
|
||||
changeMethods,
|
||||
|
||||
@@ -27,10 +27,13 @@ import { Form } from 'src/components/Form';
|
||||
import {
|
||||
accessTokenField,
|
||||
databaseField,
|
||||
defaultCatalogField,
|
||||
defaultSchemaField,
|
||||
displayField,
|
||||
forceSSLField,
|
||||
hostField,
|
||||
httpPath,
|
||||
httpPathField,
|
||||
passwordField,
|
||||
portField,
|
||||
queryField,
|
||||
@@ -47,10 +50,13 @@ export const FormFieldOrder = [
|
||||
'host',
|
||||
'port',
|
||||
'database',
|
||||
'default_catalog',
|
||||
'default_schema',
|
||||
'username',
|
||||
'password',
|
||||
'access_token',
|
||||
'http_path',
|
||||
'http_path_field',
|
||||
'database_name',
|
||||
'credentials_info',
|
||||
'service_account_info',
|
||||
@@ -71,8 +77,11 @@ const SSHTunnelSwitchComponent =
|
||||
const FORM_FIELD_MAP = {
|
||||
host: hostField,
|
||||
http_path: httpPath,
|
||||
http_path_field: httpPathField,
|
||||
port: portField,
|
||||
database: databaseField,
|
||||
default_catalog: defaultCatalogField,
|
||||
default_schema: defaultSchemaField,
|
||||
username: usernameField,
|
||||
password: passwordField,
|
||||
access_token: accessTokenField,
|
||||
|
||||
@@ -633,11 +633,23 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
|
||||
const history = useHistory();
|
||||
|
||||
const dbModel: DatabaseForm =
|
||||
// TODO: we need a centralized engine in one place
|
||||
|
||||
// first try to match both engine and driver
|
||||
availableDbs?.databases?.find(
|
||||
(available: {
|
||||
engine: string | undefined;
|
||||
default_driver: string | undefined;
|
||||
}) =>
|
||||
available.engine === (isEditMode ? db?.backend : db?.engine) &&
|
||||
available.default_driver === db?.driver,
|
||||
) ||
|
||||
// alternatively try to match only engine
|
||||
availableDbs?.databases?.find(
|
||||
(available: { engine: string | undefined }) =>
|
||||
// TODO: we need a centralized engine in one place
|
||||
available.engine === (isEditMode ? db?.backend : db?.engine),
|
||||
) || {};
|
||||
) ||
|
||||
{};
|
||||
|
||||
// Test Connection logic
|
||||
const testConnection = () => {
|
||||
|
||||
Reference in New Issue
Block a user