betodealmeida commented on a change in pull request #14881:
URL: https://github.com/apache/superset/pull/14881#discussion_r661877432



##########
File path: superset/databases/commands/validate.py
##########
@@ -35,6 +35,8 @@
 from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
 from superset.models.core import Database
 
+BYPASS_VALIDATION_ENGINES = ["bigquery"]

Review comment:
       Nit: make this a set

##########
File path: 
superset-frontend/src/views/CRUD/data/database/DatabaseModal/ModalHeader.tsx
##########
@@ -0,0 +1,161 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import React from 'react';
+import { getDatabaseDocumentationLinks } from 'src/views/CRUD/hooks';
+import {
+  EditHeaderTitle,
+  EditHeaderSubtitle,
+  CreateHeaderTitle,
+  CreateHeaderSubtitle,
+  StyledFormHeader,
+  StyledStickyHeader,
+} from './styles';
+import { DatabaseForm, DatabaseObject } from '../types';
+
+export const DOCUMENTATION_LINK =
+  'https://superset.apache.org/docs/databases/installing-database-drivers';
+
+const supersetTextDocs = getDatabaseDocumentationLinks();
+
+const irregularDocumentationLinks = {
+  postgresql: 'https://superset.apache.org/docs/databases/postgres',
+  mssql: 'https://superset.apache.org/docs/databases/sql-server',
+};
+
+const documentationLink = (engine: string | undefined) => {
+  if (!engine) return null;
+
+  if (supersetTextDocs) {
+    // override doc link for superset_txt yml
+    return supersetTextDocs[engine] || supersetTextDocs.default;
+  }
+
+  if (!irregularDocumentationLinks[engine]) {
+    return `https://superset.apache.org/docs/databases/${engine}`;
+  }
+  return irregularDocumentationLinks[engine];
+};
+const ModalHeader = ({
+  isLoading,
+  isEditMode,
+  useSqlAlchemyForm,
+  hasConnectedDb,
+  db,
+  dbName,
+  dbModel,
+  editNewDb,
+}: {
+  isLoading: boolean;
+  isEditMode: boolean;
+  useSqlAlchemyForm: boolean;
+  hasConnectedDb: boolean;
+  db: Partial<DatabaseObject> | null;
+  dbName: string;
+  dbModel: DatabaseForm;
+  editNewDb?: boolean;
+}) => {
+  const isEditHeader = (
+    <StyledFormHeader>
+      <EditHeaderTitle>{db?.backend}</EditHeaderTitle>
+      <EditHeaderSubtitle>{dbName}</EditHeaderSubtitle>
+    </StyledFormHeader>
+  );
+  const useSqlAlchemyFormHeader = (
+    <StyledFormHeader>
+      <p className="helper"> STEP 2 OF 2 </p>
+      <CreateHeaderTitle>Enter Primary Credentials</CreateHeaderTitle>
+      <CreateHeaderSubtitle>
+        Need help? Learn how to connect your database{' '}
+        <a
+          href={supersetTextDocs?.default || DOCUMENTATION_LINK}
+          target="_blank"
+          rel="noopener noreferrer"
+        >
+          here
+        </a>
+        .
+      </CreateHeaderSubtitle>
+    </StyledFormHeader>
+  );
+  const hasConnectedDbHeader = (
+    <StyledStickyHeader>
+      <StyledFormHeader>
+        <p className="helper"> STEP 3 OF 3 </p>
+        <h4>
+          Your database was successfully connected! Here are some optional
+          settings for your database

Review comment:
       All the strings in this file need to be translatable, but we can do that 
later.

##########
File path: superset/databases/schemas.py
##########
@@ -274,7 +279,11 @@ def build_sqlalchemy_uri(
             # validate parameters
             parameters = engine_spec.parameters_schema.load(parameters)  # 
type: ignore
 
-            serialized_encrypted_extra = data.get("encrypted_extra", "{}")
+            serialized_encrypted_extra = (
+                data.get("encrypted_extra", "{}")
+                if data.get("encrypted_extra")
+                else "{}"
+            )

Review comment:
       Nit:
   
   ```suggestion
               serialized_encrypted_extra =  data.get("encrypted_extra") or "{}"
   ```

##########
File path: superset/config.py
##########
@@ -1085,10 +1085,10 @@ def CSV_TO_HIVE_UPLOAD_DIRECTORY_FUNC(
 # use the "engine_name" attribute of the corresponding DB engine spec
 # in `superset/db_engine_specs/`.
 PREFERRED_DATABASES: List[str] = [
-    # "PostgreSQL",
-    # "Presto",
-    # "MySQL",
-    # "SQLite",
+    "PostgreSQL",
+    "Presto",
+    "MySQL",
+    "SQLite",
     # etc.

Review comment:
       Do we wanna curate this list better? I just wrote these of the top of my 
head.

##########
File path: 
superset-frontend/src/views/CRUD/data/database/DatabaseModal/ExtraOptions.tsx
##########
@@ -59,20 +60,20 @@ const ExtraOptions = ({
           <div>
             <h4>SQL Lab</h4>
             <p className="helper">
-              Configure how this database will function in SQL Lab.
+              Adjust how this database will interact with SQL Lab.

Review comment:
       A few more here that need to be translatable.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to