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 Ocient support #22812

Merged
merged 30 commits into from
Apr 23, 2023
Merged

feat: Add Ocient support #22812

merged 30 commits into from
Apr 23, 2023

Conversation

alexclavel-ocient
Copy link
Contributor

WIP

SUMMARY

Adding support for Ocient databases

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

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

jwilliams-ocient and others added 2 commits January 13, 2023 08:44
 * doc: add docstrings to functions
 * chore: clean up comments
 * perf: avoid copying row data that doesn't need to be sanitized
@alexclavel-ocient alexclavel-ocient marked this pull request as draft January 20, 2023 20:39
@alexclavel-ocient alexclavel-ocient changed the title wip: feat: Add Ocient support feat: Add Ocient support Jan 24, 2023
@rusackas rusackas marked this pull request as ready for review January 24, 2023 16:16
@rusackas rusackas marked this pull request as draft January 24, 2023 16:16
jwilliams-ocient and others added 5 commits January 24, 2023 12:02
* Fix: Replace invalid inplace type conversion

* Nit: Add comment clarifying why we cannot update in place

* Nit: Generate functions based on cursor, not rows
* Adding support for query cancellation

* Removing double import

* Adding support for query cancellation

Removing double import

Inverting logic for fetch data.

Re-add missing function

* Fiding doubled up merge inputs

* Handle Query cancellation for multiple queries

* Adding mutex lock to query id mapping

* Removing unecesssary iteration over values of cache

* Fixing locks in db engine spec

* Fix error capture in fetch_data
@alexclavel-ocient alexclavel-ocient marked this pull request as ready for review January 31, 2023 20:41
@jwilliams-ocient
Copy link
Contributor

Thanks for putting this PR up @alexclavel-ocient !

A note for the rock star reviewers: expect 1 additional commit for the user doc 🙂 !

@betodealmeida
Copy link
Member

This looks great! Feel free to ping me when when doc is up (here or on Slack) and I'll review it! <3

Copy link
Member

@betodealmeida betodealmeida left a comment

Choose a reason for hiding this comment

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

This looks really good, it's nice to see a DB engine spec so complete! 💪🏼

I left a question about using threading and async query execution.

```

**NOTE**: You must enter the `user` and `password` credentials. `host` defaults to localhost,
port defaults to 4050, database defaults to `system` and `tls` defaults
Copy link
Member

Choose a reason for hiding this comment

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

How is tls passed to the URL?

Copy link
Contributor

Choose a reason for hiding this comment

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

Great question! We should definitely provide an example here - will fix

superset/db_engine_specs/ocient.py Outdated Show resolved Hide resolved
# These are inserted into the cache when executing the query
# They are then removed, either upon cancellation or query completion
query_id_mapping: Dict[str, str] = dict()
query_id_mapping_lock = threading.Lock()
Copy link
Member

Choose a reason for hiding this comment

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

Did you also test this with async queries? (with the query being executed by Celery)

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @betodealmeida , I am the Ocient developer tasked with pushing this PR over the finish line, thanks for all of your help thus far!

Is there an integration test that stresses this async queries + ocient, or just a manual look-and-pray-for-racy-condition-if-exists? Pardon my ignorance, I found this doc, but couldn't find anything w.r.t. testing.

* Fix: make cte_alias compatible with Ocient

* Fixing indentation in ocient.py
@alexclavel-ocient
Copy link
Contributor Author

@betodealmeida Any Idea why the CI cannot find pyocient? We have sqlalchemy-ocient in setup.py, and pyocient is a requirement for sqlalchemy-ocient.

@betodealmeida
Copy link
Member

@betodealmeida Any Idea why the CI cannot find pyocient? We have sqlalchemy-ocient in setup.py, and pyocient is a requirement for sqlalchemy-ocient.

The dependency in setup.py is optional, to have it run with CI you need to add it to requirements/testing.in:

-e file:.[bigquery,hive,presto,trino]

@jwilliams-ocient
Copy link
Contributor

Is it possible for me to kick off a CI run using the Superset infra on my end?

@villebro
Copy link
Member

@jwilliams-ocient I started CI (after your first merged PR CI will start automatically)

jwilliams-ocient and others added 2 commits April 12, 2023 09:10
* docs: add example of setting DSN params

* docs: apply review suggestions

Co-authored-by: rmasters1 <100157128+rmasters1@users.noreply.github.com>

---------

Co-authored-by: rmasters1 <100157128+rmasters1@users.noreply.github.com>
@jwilliams-ocient
Copy link
Contributor

Hi @villebro , sorry to bug you again, but could you kick off another CI run for me? Crossing my fingers this is the final attempt 🤞🏾

@villebro
Copy link
Member

Sure 👍

@jwilliams-ocient
Copy link
Contributor

Ugh, once more, please? I'm an idiot and pushed a partial commit.

In the event this run fails causing me to have to push another commit,, should I just create a separate PR with a single, empty commit in order to gain write access / stop bugging your team for trivial hit-the-run-button tasks? @villebro 🙏🏾

@villebro
Copy link
Member

@jwilliams-ocient absolutely no problem! 🙂👍

@jwilliams-ocient
Copy link
Contributor

Alright, @villebro , hopefully this is the last time I bug you today 😆. Here is a request for write access #23755

@villebro
Copy link
Member

Alright, @villebro , hopefully this is the last time I bug you today 😆. Here is a request for write access #23755

@jwilliams-ocient on a slightly related note, I recently read James Dyson's book "Invention, a life", in which he mentions that it took him 5127 prototypes before his first vacuum cleaner worked. So we're still far off from that figure 😂

* refactor: holy shit I botched another commit lol

* fix: address warnings generated by pylint

* fix: fix custom errors matchers

* test: fix broken unit tests
@codecov
Copy link

codecov bot commented Apr 20, 2023

Codecov Report

Merging #22812 (2b52c93) into master (9dfaad7) will increase coverage by 0.78%.
The diff coverage is 35.20%.

❗ Current head 2b52c93 differs from pull request most recent head e82386e. Consider uploading reports for the commit e82386e to get more accurate results

@@            Coverage Diff             @@
##           master   #22812      +/-   ##
==========================================
+ Coverage   67.29%   68.07%   +0.78%     
==========================================
  Files        1878     1924      +46     
  Lines       72137    74238    +2101     
  Branches     7866     8103     +237     
==========================================
+ Hits        48541    50537    +1996     
- Misses      21577    21624      +47     
- Partials     2019     2077      +58     
Flag Coverage Δ
hive 53.27% <ø> (?)
mysql 79.18% <ø> (+0.93%) ⬆️
postgres 79.25% <ø> (+0.95%) ⬆️
presto 53.18% <ø> (?)
python 83.10% <ø> (+1.27%) ⬆️
sqlite 77.75% <ø> (+1.12%) ⬆️
unit 53.06% <ø> (+0.56%) ⬆️

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

Impacted Files Coverage Δ
...ackages/superset-ui-chart-controls/src/fixtures.ts 100.00% <ø> (ø)
...et-ui-chart-controls/src/operators/sortOperator.ts 100.00% <ø> (ø)
...t-ui-chart-controls/src/shared-controls/mixins.tsx 16.66% <ø> (ø)
...d/packages/superset-ui-chart-controls/src/types.ts 100.00% <ø> (ø)
.../packages/superset-ui-core/src/chart/types/Base.ts 100.00% <ø> (ø)
...-core/src/hooks/useChangeEffect/useChangeEffect.ts 100.00% <ø> (ø)
...hooks/useComponentDidMount/useComponentDidMount.ts 100.00% <ø> (ø)
...oks/useComponentDidUpdate/useComponentDidUpdate.ts 100.00% <ø> (ø)
...src/hooks/useElementOnScreen/useElementOnScreen.ts 100.00% <ø> (ø)
...erset-ui-core/src/hooks/usePrevious/usePrevious.ts 100.00% <ø> (ø)
... and 122 more

... and 463 files with indirect coverage changes

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

* style: run pre-commit hooks

* style: remove type annotations that may not exist

* build: remove ocient from requirements/testing.in
@jwilliams-ocient
Copy link
Contributor

jwilliams-ocient commented Apr 21, 2023

Is the failure from E2E / cypress-matrix (2, chrome) (pull_request) a flaky test? I'm unsure if the failure is related to our changes.

CC: @villebro , @rusackas

@rusackas rusackas merged commit adde667 into apache:master Apr 23, 2023
27 checks passed
@jwilliams-ocient
Copy link
Contributor

Hi @rusackas , @betodealmeida , and @villebro. On behalf of Ocient, I just wanted to say thank you for helping us push this PR through, much appreciated!

@rusackas
Copy link
Member

Thanks to @jwilliams-ocient and @alexclavel-ocient for contributing this! If you want to talk about next steps to spread the word, hit me up on Slack!

sebastianliebscher pushed a commit to sebastianliebscher/superset that referenced this pull request Apr 28, 2023
Co-authored-by: jwilliams-ocient <60358443+jwilliams-ocient@users.noreply.github.com>
Co-authored-by: Jordan Williams <jwilliams@ocient.com>
Co-authored-by: rmasters1 <100157128+rmasters1@users.noreply.github.com>
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.0.0 labels Mar 13, 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/XL 🚢 3.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants