Skip to content

Switch SQL Editor to Query Builder on Explore view not working at the version >= 4.5.0 #1080

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

Open
nonylene opened this issue Dec 7, 2024 · 2 comments

Comments

@nonylene
Copy link

nonylene commented Dec 7, 2024

What happened:

We cannot switch SQL Editor to Query Builder on Explore view when the query is not compatible with Query Builder, after upgrading the plugin to 4.5.0 / 4.5.1.

What you expected to happen:

We can switch back to Query Builder from SQL Editor as before.

How to reproduce it (as minimally and precisely as possible):

  1. Install clickhouse plugin above 4.5.0 and set up clickhouse datasource
  2. Go to Explore view and select the clickhouse as datasource
  3. Switch SQL Editor on Editor Type

Image

  1. Click Query Builder on Editor Type and click Continue on the modal
    Image

  2. We cannot go back to Query Builder even after clicking "Continue"

Below error is shown in the console on every click

utils.ts:90 Uncaught (in promise) Error: The query is not a select statement.
    at ns (utils.ts:90:11)
    at $ (EditorTypeSwitcher.tsx:51:28)
    at h (EditorTypeSwitcher.tsx:78:5)
    at B (ConfirmContent.tsx:84:13)
    at index.esm.mjs:2271:23

Screenshots

Image

The first syntax error should be expected, which is thrown on 4.4.0 too.

Anything else we need to know?:

On 4.4.0, we can switch back to Query Builder after clicking "Continue".

Environment:

  • Grafana version: Grafana v11.3.1 (64b556c137)
  • Plugin version: 4.5.1
  • OS Grafana is installed on: Kubernetes (Grafana helm chart)
  • User OS & Browser: Windows 11 / Chrome Version 131.0.6778.86 (Official Build) (64-bit)
  • Others:
@nonylene nonylene added datasource/ClickHouse type/bug Something isn't working labels Dec 7, 2024
@nonylene nonylene changed the title Switch SQL Editor to Query Builder on Explore view not working Switch SQL Editor to Query Builder on Explore view not working at the version > 4.5.0 Dec 7, 2024
@nonylene nonylene changed the title Switch SQL Editor to Query Builder on Explore view not working at the version > 4.5.0 Switch SQL Editor to Query Builder on Explore view not working at the version >= 4.5.0 Dec 7, 2024
@robinpecha
Copy link

+1

@SpencerTorres
Copy link
Collaborator

This is a problem with our plugin's AST module trying to convert the SQL to a query builder object, although it shouldn't be failing completely. It should allow you to switch the editor even with an invalid query. If it fails to parse then it should simply use the default query builder object.

As a workaround for now, you can try emptying the query, or putting a basic SELECT 1 in the input

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants