Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add MotherDuck DB engine spec #24934

Merged
merged 4 commits into from
Aug 9, 2023
Merged

feat: add MotherDuck DB engine spec #24934

merged 4 commits into from
Aug 9, 2023

Conversation

betodealmeida
Copy link
Member

@betodealmeida betodealmeida commented Aug 9, 2023

SUMMARY

Add a separate DB engine spec for MotherDuck, a cloud version of DuckDB. While adding the spec I did a few QoL improvements:

  • Fixed the "Refer to the SQLAlchemy docs for more information on how to structure your URI." text, which said only "Refer to the for more information on how to structure your URI."
  • Display the sqlalchemy_uri_placeholder as the placeholder for the SQLAlchemy URI.
  • Add the optional duckdb dependency to Superset, with the library needed to run DuckDB and connect to MotherDuck.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before, using the DuckDB driver, note that we show the generic placeholder and that the text is missing the link to the docs:

Screenshot 2023-08-09 at 08-54-23 Superset

After, we show the correct placeholder, and the text is fixed:

Screenshot 2023-08-09 at 08-52-00 Superset

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • 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

@@ -38,17 +38,13 @@ const SqlAlchemyTab = ({
testInProgress?: boolean;
children?: ReactNode;
}) => {
let fallbackDocsUrl;
let fallbackDisplayText;
if (SupersetText) {
Copy link
Member Author

@betodealmeida betodealmeida Aug 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SupersetText is either a module or {}, and both are truthy.

const loadModule = () => {
try {
// eslint-disable-next-line global-require, import/no-unresolved
return require('../../../superset_text') || {};
} catch (e) {
return {};
}
};

@@ -1958,11 +1964,6 @@ class BasicParametersMixin:
# recommended driver name for the DB engine spec
default_driver = ""

# placeholder with the SQLAlchemy URI template
sqlalchemy_uri_placeholder = (
Copy link
Member Author

@betodealmeida betodealmeida Aug 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving this from the "dynamic form" mixin to the base DB engine spec.

@codecov
Copy link

codecov bot commented Aug 9, 2023

Codecov Report

Merging #24934 (23af5eb) into master (ec9e9a4) will increase coverage by 0.00%.
Report is 4 commits behind head on master.
The diff coverage is 73.43%.

❗ Current head 23af5eb differs from pull request most recent head de7d069. Consider uploading reports for the commit de7d069 to get more accurate results

@@           Coverage Diff           @@
##           master   #24934   +/-   ##
=======================================
  Coverage   69.00%   69.00%           
=======================================
  Files        1906     1906           
  Lines       74133    74149   +16     
  Branches     8208     8211    +3     
=======================================
+ Hits        51153    51169   +16     
+ Misses      20857    20856    -1     
- Partials     2123     2124    +1     
Flag Coverage Δ
hive 54.17% <24.13%> (-0.01%) ⬇️
javascript 55.84% <100.00%> (+<0.01%) ⬆️
mysql 79.21% <70.68%> (+<0.01%) ⬆️
postgres 79.32% <70.68%> (+<0.01%) ⬆️
presto 54.07% <24.13%> (-0.01%) ⬇️
python 83.37% <70.68%> (+<0.01%) ⬆️
sqlite 77.89% <70.68%> (+<0.01%) ⬆️
unit 55.05% <24.13%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
...rset-frontend/src/components/ErrorMessage/types.ts 100.00% <ø> (ø)
superset-frontend/src/dashboard/actions/hydrate.js 2.04% <ø> (ø)
...et-frontend/src/dashboard/components/SaveModal.tsx 39.28% <ø> (ø)
superset/cli/native_filters.py 0.00% <0.00%> (ø)
superset/databases/api.py 89.95% <ø> (ø)
...uperset/utils/dashboard_filter_scopes_converter.py 15.38% <0.00%> (-0.41%) ⬇️
superset/security/manager.py 94.43% <94.44%> (ø)
...set-frontend/src/dashboard/util/permissionUtils.ts 88.23% <100.00%> (+1.56%) ⬆️
...eatures/databases/DatabaseModal/SqlAlchemyForm.tsx 63.63% <100.00%> (+2.09%) ⬆️
...end/src/features/databases/DatabaseModal/index.tsx 43.66% <100.00%> (ø)
... and 7 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

setup.py Outdated
@@ -150,6 +150,7 @@ def get_git_sha() -> str:
"dremio": ["sqlalchemy-dremio>=1.1.5, <1.3"],
"drill": ["sqlalchemy-drill==0.1.dev"],
"druid": ["pydruid>=0.6.5,<0.7"],
"duckdb": ["duckdb-engine==0.8.0"],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@betodealmeida should this be >=0.8.0,<1.0.0?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@john-bodley could be, but in general I prefer to pin 0.x versions instead of using a range, since in theory the API is not sable and 0.8.1 could introduce breaking changes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On that note, 0.8.1 is out, and seems to follow semver
https://github.com/duckdb/duckdb/releases/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could go either way on this... trying to rationalize a preference.

If we pin the version, and there's an issue (potentially security) then we might have a fire drill on our hands.

If we use a range, and something breaks, we might have a bug on our hands.

By the "lesser evil" metric, I think this might put the range idea ahead in my mind by about the width of a frog hair, as long as they stick to semver ;)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I know they were planning to change how databases are returned by their dialect, so maybe we keep this frozen until they hit 1.0?

Also, this is an optional dependency, people can always install a newer version if they want.

@john-bodley john-bodley added the review:checkpoint Last PR reviewed during the daily review standup label Aug 9, 2023
Copy link
Member

@rusackas rusackas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we want to pin or not... and not sure if we want to bump the pinned version or not. But neither issue will keep me up at night and the rest looks good to me!

@betodealmeida betodealmeida merged commit 9c54280 into master Aug 9, 2023
@michael-s-molina michael-s-molina removed the review:checkpoint Last PR reviewed during the daily review standup label Aug 10, 2023
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.1.0 labels Mar 8, 2024
@mistercrunch mistercrunch deleted the add_motherduck branch March 26, 2024 16:24
vinothkumar66 pushed a commit to vinothkumar66/superset that referenced this pull request Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/M 🚢 3.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants