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

Issues about when to quote database/tables #153

Closed
bitbier opened this issue Mar 23, 2022 · 1 comment · Fixed by #155 or #159
Closed

Issues about when to quote database/tables #153

bitbier opened this issue Mar 23, 2022 · 1 comment · Fixed by #155 or #159

Comments

@bitbier
Copy link

bitbier commented Mar 23, 2022

What happened:

Ever since we upgraded to 1.5.0 from 1.4.x, we had to fix how we are sending in
our default database name and table names. We have to explicitly wrap our
values in "". Otherwise, when you go to explore Timestream datasource,
the Database and Table Macro dropdowns are not prepopulated with our values.

What you expected to happen:

We expect that timestream plugin to be smart and handle the quoting for us,
I.e. if defaultDatabase is my_test_db or "my_test_db" it should handle
the correct quoting when being supplied to timestream APIs.

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

  1. Using a docker container with timestream 1.5.0 plugin installed

  2. Using the following /etc/grafana/provisioning/datasources/timestream.yaml:

    apiVersion: 1
    
    datasources:
      - name: Timestream
        type: grafana-timestream-datasource
        jsonData:
          authType: default
    
          # Default timestream variables
          defaultDatabase: "${GF_TIMESTREAM_DEFAULT_DATABASE_NAME}"
          defaultTable: "${GF_TIMESTREAM_DEFAULT_TABLE_NAME}"
    
  3. Sending the following variables:

    • GF_TIMESTREAM_DEFAULT_DATABASE_NAME: "my_test_db"
    • GF_TIMESTREAM_DEFAULT_TABLE_NAME: "my_test_table"
  4. Go to Explore -> Select Timestream Datasource

  5. View the Macros table and see that it is empty

To fix the above issue, you need to explicitly wrap '"my_test_db"' and '"my_test_table"'.
You could also maybe able to change the yaml to include the explicit quoting, but I haven't
tried that.

Anything else we need to know?:

FYI, we have this fixed. It's more a UX issue for others. Just need to make sure that
things are quoted in the correct places, which again could be done with the plugin.

Environment:

  • Grafana version: v8.3.4 (a551d74b1)
  • Plugin version: 1.5.0
  • OS Grafana is installed on: Official grafana docker container + layers to add plugin installation
  • User OS & Browser: Safari 15.3 (17612.4.9.1.8)
@fridgepoet
Copy link
Member

fridgepoet commented Mar 24, 2022

Thanks for pointing out the issue, we've identified a breaking change in the macros while getting the tables. Before there were systematically quotes added all the time.
But now when the DB name comes from provisioning (and as you pointed out doesn't have quotes), then the name is left as-is.

The workaround is as you've stated:

  • add the quotes in your variables
  • change` the yaml to have the explicit quoting too

Thank you @andresmgot for the help in qualifying the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
2 participants