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 TDengine.py driver to db_engine #32041

Merged
merged 19 commits into from
Feb 6, 2025

Conversation

DuanKuanJun
Copy link
Contributor

@DuanKuanJun DuanKuanJun commented Jan 30, 2025

feat: SuperSet support TDengine data source

SUMMARY

Through db_engine_spec for TDengine, Superset can support TDengine data sources and provide functions such as data presentation and analysis, see detail.

TESTING INSTRUCTIONS

  1. Install python connector for TDengine pip3 install taospy && pip3 install taos-ws-py
  2. Enter the new database connection page, "Superset" → "Setting" → "Database Connections" → "+DATABASE"
  3. Select TDengine database connection, select the "TDengine" option from the drop-down list of "SUPPORTED DATABASES".
  4. Write a name of connection in "DISPLAY NAME"
  5. The "SQLALCHEMY URL" field is a key connection information string, and it must be filled in correctly.
    format: taosws://user:password@host:port
  6. Configure the connection string, click "TEST CONNECTION" to test if the connection can be successful. After passing the test, click the "CONNECT" button to complete the connection

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

@dosubot dosubot bot added data:connect Namespace | Anything related to db connections / integrations enhancement:db Suggest new DB connections labels Jan 30, 2025
Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

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

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Fix Detected
Security Insecure Credential Example in URI Placeholder ▹ view

Need a new review? Comment /korbit-review on this PR and I'll review your latest changes.

Korbit Guide: Usage and Customization

Interacting with Korbit

  • You can manually ask Korbit to review your PR using the /korbit-review command in a comment at the root of your PR.
  • You can ask Korbit to generate a new PR description using the /korbit-generate-pr-description command in any comment on your PR.
  • Too many Korbit comments? I can resolve all my comment threads if you use the /korbit-resolve command in any comment on your PR.
  • Chat with Korbit on issues we post by tagging @korbit-ai in your reply.
  • Help train Korbit to improve your reviews by giving a 👍 or 👎 on the comments Korbit posts.

Customizing Korbit

  • Check out our docs on how you can make Korbit work best for you and your team.
  • Customize Korbit for your organization through the Korbit Console.

Feedback and Support

superset/db_engine_specs/TDengine.py Outdated Show resolved Hide resolved
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Congrats on making your first PR and thank you for contributing to Superset! 🎉 ❤️

We hope to see you in our Slack community too! Not signed up? Use our Slack App to self-register.

@pull-request-size pull-request-size bot added size/M and removed size/S labels Jan 30, 2025
@github-actions github-actions bot added the doc Namespace | Anything related to documentation label Jan 30, 2025
@sadpandajoe
Copy link
Member

@DuanKuanJun thanks for opening this PR. Can you fill out the description for this PR?

Copy link

codecov bot commented Jan 30, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.47%. Comparing base (b12f515) to head (7980c6b).
Report is 25 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #32041       +/-   ##
===========================================
+ Coverage        0   83.47%   +83.47%     
===========================================
  Files           0      546      +546     
  Lines           0    39057    +39057     
===========================================
+ Hits            0    32603    +32603     
- Misses          0     6454     +6454     
Flag Coverage Δ
hive 48.51% <93.33%> (?)
mysql 75.88% <93.33%> (?)
postgres 75.95% <93.33%> (?)
presto 53.05% <93.33%> (?)
python 83.47% <100.00%> (?)
sqlite 75.46% <93.33%> (?)
unit 61.02% <100.00%> (?)

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pull-request-size pull-request-size bot added size/L and removed size/M labels Feb 1, 2025
@DuanKuanJun
Copy link
Contributor Author

DuanKuanJun commented Feb 1, 2025

@DuanKuanJun thanks for opening this PR. Can you fill out the description for this PR?

already fill out the description
@sadpandajoe

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

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

Please check how to correctly define the dependencies. Also, tests seem to be failing, please check CI logs.

docs/docs/configuration/databases.mdx Outdated Show resolved Hide resolved
@DuanKuanJun
Copy link
Contributor Author

Please check how to correctly define the dependencies. Also, tests seem to be failing, please check CI logs.
@villebro , I submit fixed code, but CI could not run, show tips "Expected — Waiting for status to be reported"

@DuanKuanJun DuanKuanJun requested a review from villebro February 2, 2025 08:31
@rusackas
Copy link
Member

rusackas commented Feb 2, 2025

Running CI now 🤞

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

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

A few additional comments. CI is still failing, please check the logs for what the issues are.

superset/db_engine_specs/TDengine.py Outdated Show resolved Hide resolved
superset/db_engine_specs/TDengine.py Outdated Show resolved Hide resolved
Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

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

LGTM. There's still CI issues, please check those. You may benefit from installing pre-commit hooks. Please check https://superset.apache.org/docs/contributing/development#git-hooks, as these automatically correct any code formatting issues for you.

superset/db_engine_specs/TDengine.py Outdated Show resolved Hide resolved
superset/db_engine_specs/TDengine.py Outdated Show resolved Hide resolved
@DuanKuanJun
Copy link
Contributor Author

DuanKuanJun commented Feb 5, 2025

check ok on local machine.
root@test ~/dev/alex/superset (db_engine_TDengine)$ pre-commit run --files superset/db_engine_specs/TDengine.py
auto-walrus..............................................................Passed
mypy.....................................................................Passed
check docstring is first.................................................Passed
check for added large files..............................................Passed
check yaml...........................................(no files to check)Skipped
debug statements (python)................................................Passed
fix end of files.........................................................Passed
trim trailing whitespace.................................................Passed
prettier.............................................(no files to check)Skipped
eslint...............................................(no files to check)Skipped
Blacklist................................................................Passed
Helm Docs............................................(no files to check)Skipped
ruff.....................................................................Passed
ruff-format..............................................................Passed
root@test ~/dev/alex/superset (db_engine_TDengine)$ pre-commit run --files tests/unit_tests/db_engine_specs/test_TDengine.py
auto-walrus..............................................................Passed
mypy.....................................................................Passed
check docstring is first.................................................Passed
check for added large files..............................................Passed
check yaml...........................................(no files to check)Skipped
debug statements (python)................................................Passed
fix end of files.........................................................Passed
trim trailing whitespace.................................................Passed
prettier.............................................(no files to check)Skipped
eslint...............................................(no files to check)Skipped
Blacklist................................................................Passed
Helm Docs............................................(no files to check)Skipped
ruff.....................................................................Passed
ruff-format..............................................................Passed
root@test ~/dev/alex/superset (db_engine_TDengine)$

@DuanKuanJun
Copy link
Contributor Author

@villebro , help me start CI , fix pre-commit check failed, thank you.

@DuanKuanJun
Copy link
Contributor Author

@villebro , please help me run ci agian , missed to submit test_TDengine.py for pre-commit checking, Thank you.

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

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

Three things that you should change, in addition to anything reported by CI:

  1. Remove superset/db_engine_specs/test_TDengine.py, which seems to be duplicated
  2. Rename TDengine.py to tdengine.py
  3. Rename test_TDengine.py to test_tdengine.py

superset/db_engine_specs/test_TDengine.py Outdated Show resolved Hide resolved
@DuanKuanJun
Copy link
Contributor Author

@villebro , sorry , can you help me run again.

@DuanKuanJun
Copy link
Contributor Author

Three things that you should change, in addition to anything reported by CI:

  1. Remove superset/db_engine_specs/test_TDengine.py, which seems to be duplicated
  2. Rename TDengine.py to tdengine.py
  3. Rename test_TDengine.py to test_tdengine.py

Three problems is done.

I have another problem, how can I see docs/static/img/tdengine.png display effect ? I not sure size is ok , have a preview address to see ?
@villebro

@villebro
Copy link
Member

villebro commented Feb 6, 2025

I have another problem, how can I see docs/static/img/tdengine.png display effect ? I not sure size is ok , have a preview address to see ? @villebro

You can run the docs locally (it should be fairly easy). But the pic looks good at quick glance.

@DuanKuanJun
Copy link
Contributor Author

I have another problem, how can I see docs/static/img/tdengine.png display effect ? I not sure size is ok , have a preview address to see ? @villebro

You can run the docs locally (it should be fairly easy). But the pic looks good at quick glance.
Thanks, I try locally.
I submit a new commit to fix unit test , forget to modify import library name to lowercase , very sorry.

@villebro villebro merged commit 649a0de into apache:master Feb 6, 2025
46 checks passed
@DuanKuanJun
Copy link
Contributor Author

Thank you very much @villebro , When is the next version of Superset expected to be released ?

@DuanKuanJun
Copy link
Contributor Author

@villebro , sorry, tdengine logo not show, tdengine.png need put to static/img/databases/ , I need create a new PR to move.

@DuanKuanJun
Copy link
Contributor Author

@villebro , new PR address : #32176

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:connect Namespace | Anything related to db connections / integrations doc Namespace | Anything related to documentation enhancement:db Suggest new DB connections size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants