You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "Vitor-Avila (via GitHub)" <gi...@apache.org> on 2024/05/08 22:44:35 UTC

[PR] chore(Databricks): New Databricks driver [superset]

Vitor-Avila opened a new pull request, #28393:
URL: https://github.com/apache/superset/pull/28393

   ### SUMMARY
   The `sqlalchemy-databricks` package ([reference](https://github.com/crflynn/sqlalchemy-databricks)) was deprecated in favor of the updated version of `databricks-sql-python` ([reference](https://github.com/databricks/databricks-sql-python)). This new version allows users to connect to Databricks using:
   
   ```
   databricks://token:dapi***@***.cloud.databricks.com?http_path=/sql/***&catalog=**&schema=**
   ```
   
   As a result, some more recent features are only supported with this driver. For example, if you create a table in Databricks with a `CLUSTER BY` configuration, it's not possible to create a dataset using `databricks+connector://` as it doesn't successfully handle this metadata.
   
   This PR introduces a new engine spec for the updated driver version, exposing a dynamic form. I believe long-term would be beneficial to deprecate the other engine specs (migrating existing connections to the new one) but for now this PR only implements support for the driver to validate with users on compatibility.
   
   The dynamic form also includes fields for `catalog` and `schema`, so this could also help with catalog support.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   New dynamic form:
   
   ![image](https://github.com/apache/superset/assets/96086495/9d850922-8012-440a-883e-d29ceae8d0dd)
   
   ### TESTING INSTRUCTIONS
   1. Connect to Databricks using the **Databricks Python Connector** option in the database dropdown.
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] chore(Databricks): New Databricks driver [superset]

Posted by "Vitor-Avila (via GitHub)" <gi...@apache.org>.
Vitor-Avila commented on code in PR #28393:
URL: https://github.com/apache/superset/pull/28393#discussion_r1594780215


##########
superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/CommonParameters.tsx:
##########
@@ -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 = ({

Review Comment:
   Had to create a new field for **HTTP Path** as the existing one included logic to retrieve/insert information in the `engine_params`



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] chore(Databricks): New Databricks driver [superset]

Posted by "Vitor-Avila (via GitHub)" <gi...@apache.org>.
Vitor-Avila commented on PR #28393:
URL: https://github.com/apache/superset/pull/28393#issuecomment-2103045489

   thank you @betodealmeida 🙏 I think long term would be interesting to at least deprecate the `connector` driver and migrate existing connections to this new driver. I'm not too familiar with Databricks to tell if we still need to keep `hive` and `odbc` or if those could also be migrated. 
   
   Feel free to merge this PR if you want to continue working on catalogs -- I'll create a follow up PR to implement unit tests for this new driver.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] chore(Databricks): New Databricks driver [superset]

Posted by "betodealmeida (via GitHub)" <gi...@apache.org>.
betodealmeida commented on PR #28393:
URL: https://github.com/apache/superset/pull/28393#issuecomment-2102613020

   @Vitor-Avila you need to rebase to fix the failing tests, @dpgaspar fixed them in `master` today.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] chore(Databricks): New Databricks driver [superset]

Posted by "Vitor-Avila (via GitHub)" <gi...@apache.org>.
Vitor-Avila commented on PR #28393:
URL: https://github.com/apache/superset/pull/28393#issuecomment-2101630789

   Going to implement tests in a future commit


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] chore(Databricks): New Databricks driver [superset]

Posted by "betodealmeida (via GitHub)" <gi...@apache.org>.
betodealmeida merged PR #28393:
URL: https://github.com/apache/superset/pull/28393


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] chore(Databricks): New Databricks driver [superset]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #28393:
URL: https://github.com/apache/superset/pull/28393#issuecomment-2102754752

   ## [Codecov](https://app.codecov.io/gh/apache/superset/pull/28393?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   Attention: Patch coverage is `76.40449%` with `21 lines` in your changes are missing coverage. Please review.
   > Project coverage is 83.19%. Comparing base [(`2e5f3ed`)](https://app.codecov.io/gh/apache/superset/commit/2e5f3ed85149951200645e00e79a543de9bec02f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`23c07a8`)](https://app.codecov.io/gh/apache/superset/pull/28393?dropdown=coverage&src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   > Report is 59 commits behind head on master.
   
   | [Files](https://app.codecov.io/gh/apache/superset/pull/28393?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [superset/db\_engine\_specs/databricks.py](https://app.codecov.io/gh/apache/superset/pull/28393?src=pr&el=tree&filepath=superset%2Fdb_engine_specs%2Fdatabricks.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2RhdGFicmlja3MucHk=) | 76.40% | [21 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/28393?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   ```diff
   @@             Coverage Diff             @@
   ##           master   #28393       +/-   ##
   ===========================================
   + Coverage   60.49%   83.19%   +22.70%     
   ===========================================
     Files        1931      521     -1410     
     Lines       76241    37303    -38938     
     Branches     8566        0     -8566     
   ===========================================
   - Hits        46122    31035    -15087     
   + Misses      28015     6268    -21747     
   + Partials     2104        0     -2104     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/superset/pull/28393/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [hive](https://app.codecov.io/gh/apache/superset/pull/28393/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `49.10% <67.41%> (-0.06%)` | :arrow_down: |
   | [javascript](https://app.codecov.io/gh/apache/superset/pull/28393/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [postgres](https://app.codecov.io/gh/apache/superset/pull/28393/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `77.31% <67.41%> (?)` | |
   | [presto](https://app.codecov.io/gh/apache/superset/pull/28393/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `53.69% <67.41%> (-0.12%)` | :arrow_down: |
   | [python](https://app.codecov.io/gh/apache/superset/pull/28393/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `83.19% <76.40%> (+19.70%)` | :arrow_up: |
   | [sqlite](https://app.codecov.io/gh/apache/superset/pull/28393/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `76.77% <67.41%> (?)` | |
   | [unit](https://app.codecov.io/gh/apache/superset/pull/28393/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `58.37% <76.40%> (+0.74%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/superset/pull/28393?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org