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

Empty keys inside getAllCountsByColumn sql query #126

Closed
DylanPetrey opened this issue Dec 14, 2024 · 3 comments
Closed

Empty keys inside getAllCountsByColumn sql query #126

DylanPetrey opened this issue Dec 14, 2024 · 3 comments

Comments

@DylanPetrey
Copy link
Contributor

DylanPetrey commented Dec 14, 2024

I haven't opened this project in a while. After coming back, I selected the yesterday filter and the page crashed. Looking at the network tab, I noticed the following request with a 422 response.

URL

https://api.cloudflare.com/client/v4/accounts/[CF_ACCOUNT_ID]/analytics_engine/sql

Response

Input was invalid: sql parser error: Expected an expression:, found: )

I logged the query for this page and this is what I saw

SELECT blob3,
    double1 as isVisitor,
    SUM(_sample_interval) as count
FROM metricsDataset
WHERE timestamp >= toDateTime('2024-12-12 06:00:00') AND timestamp < toDateTime('2024-12-13 06:00:00')
    AND blob3 IN ()
    AND double1 = 0
    AND blob8 = 'counterscale-dev'
GROUP BY blob3, double1
ORDER BY count DESC
LIMIT 10

There is an empty array inside the where statement

AND blob3 IN ()

This happens when there are no keys in the array

@DylanPetrey
Copy link
Contributor Author

I already have a fix for this, just wanted to create an issue beforehand

@benvinegar
Copy link
Owner

Ah, nice catch.

@benvinegar
Copy link
Owner

Closed via #127.

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

2 participants