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

on Oracle datasource wrong query to select failed rows: LIMIT keyword doesn't exist #2123

Closed
stelapo opened this issue Jul 4, 2024 · 5 comments

Comments

@stelapo
Copy link

stelapo commented Jul 4, 2024

Hi,
I re-open the issue #2060 because the problem is still present.

I tried with the last version 3.3.9.

Soda builds the query to select failed rows samples using LIMIT keyword, but it doesn't exist in Oracle.

Query error: oracle_beneficiario_with_connstring_dev.MYTABLE.duplicate_count[MYCOLUMN].failed_rows.aggregated: ORA-00933: SQL command not properly ended

WITH frequencies AS (
    SELECT MYCOLUMN, COUNT(*) AS frequency
    FROM MYTABLE
    WHERE MYCOLUMN IS NOT NULL
    GROUP BY MYCOLUMN)
SELECT *
FROM frequencies
WHERE frequency > 1
ORDER BY frequency DESC
LIMIT 10

The correct query should use the ROWNUM keyword:

WITH frequencies AS (
    SELECT MYCOLUMN, COUNT(*) AS frequency
    FROM MYTABLE
    WHERE MYCOLUMN IS NOT NULL
    GROUP BY MYCOLUMN)
SELECT *
FROM frequencies
WHERE frequency > 1
  AND ROWNUM <= 10
ORDER BY frequency DESC

Thank you

@tools-soda
Copy link

CLOUD-8027

@benjamin-pirotte
Copy link

@m1n0 didn't we fix this recently? Or did we only fix it in Soda Library and not Soda Core?

@m1n0
Copy link
Contributor

m1n0 commented Jul 9, 2024

@stelapo could you please share the full log output showing the version? This is where that query is constructed and it uses the right keyword https://github.com/sodadata/soda-core/blob/main/soda/oracle/soda/data_sources/oracle_data_source.py#L350

@stelapo
Copy link
Author

stelapo commented Jul 12, 2024

Hi @benjamin-pirotte and @m1n0 ,
thank you for your reply.

I tried again today, but now it works. I honestly don't understand why; I had checked the installed library version using pip show.

Anyway, better that way! :)

I am closing this thread.

Finally, I would like to point out this other thread #2125; I have also checked this problem again and confirm that it exists.

Thank you very much

@stelapo stelapo closed this as completed Jul 12, 2024
@stelapo
Copy link
Author

stelapo commented Jul 12, 2024

I understand why :) .... now there's the new version 3.3.10; when I tried there was the version 3.3.9.

Thank you

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

No branches or pull requests

4 participants