Skip to content

Conversation

tim5go
Copy link
Contributor

@tim5go tim5go commented Sep 17, 2020

What type of PR is this? (check all applicable)

  • Refactor
  • Bug Fix

Description

Pull request #5088 introduced the ability to auto limit SQL results to the first 1000 results (#976). However, Oracle does not support the LIMIT clause. This PR is to handle auto limit clause in Oracle's syntax.

Related Tickets & Documents

#5180 #5088

Mobile & Desktop Screenshots/Recordings (if there are UI changes)

Copy link
Member

@arikfr arikfr left a comment

Choose a reason for hiding this comment

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

Thank you for taking a stab at this! I wonder if it will be "safer" to just turn off this functionality for Oracle?

@tim5go
Copy link
Contributor Author

tim5go commented Sep 17, 2020

@arikfr
Um... if we disable this functionality for Oracle, should we also hide the Limit 1000 Checkbox on the UI side (if Oracle is selected for datasource) for consistency?
Otherwise, people may get confused.

@kravets-levko
Copy link
Collaborator

@arikfr For me it looks that adding a limit should be implemented in query runners: some basic implementation in BaseQueryRuner, and then others may override it if needed.

@tim5go
Copy link
Contributor Author

tim5go commented Sep 17, 2020

@kravets-levko
You're right, putting the logic under BaseSQLQueryRunner makes more sense to me.
Moreover, databases like DB2, MSSQL and Informix don't support LIMIT statement neither.

As redash supports DB2, we probably need to fix the part of DB2 also.

@jhult
Copy link
Contributor

jhult commented Sep 17, 2020

For what it is worth, I merged @tim5go's code to my branch and can confirm the auto limit is working for Oracle.

@tim5go
Copy link
Contributor Author

tim5go commented Sep 18, 2020

@kravets-levko
I am refactoring the code according to your comments, will publish the changes very soon.

@tim5go tim5go requested a review from arikfr September 18, 2020 15:37
@jhult
Copy link
Contributor

jhult commented Jan 31, 2021

@tim5go and @kravets-levko, we need this fix. Right now, I have it merged locally but it would be great to have it upstream. Any news on getting this merged? It looks like it might need to be rebased on master first.

@tim5go
Copy link
Contributor Author

tim5go commented Jan 31, 2021

@jhult
yup, it seems like it needs a rebase first.
For my part, I have nothing to add. I definitely would like to have it merged, but it's really up to the Redash team.

@jhult
Copy link
Contributor

jhult commented Apr 12, 2021

@kravets-levko, any chance we can get this merged?

@jhult
Copy link
Contributor

jhult commented Jun 5, 2021

@rafawendel @kravets-levko @susodapop @arikfr,

Any news on merging this?

@susodapop
Copy link
Contributor

Hey @jhult we'll plan to merge this after the full V10 release later this summer.

PS we're also working to improve the contribution process and review SLA going forward 😉 Thanks for your patience.

@jhult
Copy link
Contributor

jhult commented Nov 3, 2021

@susodapop, now that version 10 is out, any updates on getting this merged?

@susodapop susodapop self-assigned this Dec 14, 2021
@jhult
Copy link
Contributor

jhult commented Dec 22, 2021

@susodapop, glad to see you self-assign this. Hopefully this means it can be merged soon.

@susodapop susodapop force-pushed the bug/oracle-auto-limit branch from 99c5e75 to 1c15407 Compare January 19, 2022 18:50
Copy link
Contributor

@susodapop susodapop left a comment

Choose a reason for hiding this comment

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

Thanks for your hard work on this! I've tested locally and rebased onto the latest master. Once the CircleCI build completes we're good to merge.

@susodapop
Copy link
Contributor

There's a failing test:

________________________________________________________________________________ TestRenderTemplate.test_render _________________________________________________________________________________

self = <tests.test_utils.TestRenderTemplate testMethod=test_render>

    def test_render(self):
        app = create_app()
        with app.app_context():
            d = {"failures": [{"id": 1, "name": "Failure Unit Test", "failed_at": "May 04, 2021 02:07PM UTC", "failure_reason": "", "failure_count": 1, "comment": None}]}
            html, text = [
                render_template("emails/failures.{}".format(f), d)
                for f in ["html", "txt"]
            ]
>           self.assertIn('Failure Unit Test',html)
E           TypeError: argument of type 'NoneType' is not iterable

tests/test_utils.py:93: TypeError

Researching now

@susodapop
Copy link
Contributor

The failure was my mistake. I omitted a return statement during the rebase 🤦 . Build is proceeding normally now.

@jhult
Copy link
Contributor

jhult commented Jan 20, 2022

@susodapop,

Looks like it built successfully!

@susodapop susodapop merged commit f77f1b5 into getredash:master Jan 20, 2022
harveyrendell pushed a commit to pushpay/redash that referenced this pull request Jan 8, 2025
Moves auto limit primitives to the base SQL query runner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants