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

Button not working with Postgres Datasource #1

Closed
asnakep opened this issue Jan 13, 2021 · 3 comments
Closed

Button not working with Postgres Datasource #1

asnakep opened this issue Jan 13, 2021 · 3 comments

Comments

@asnakep
Copy link

asnakep commented Jan 13, 2021

Hello,

I love this button, but unfortunately is not working with Postgres Datasources.
I'm using the json returned by query inspector, only the query part.
Button return 200 ok message, but the action defined in datasource (a table update) doesn't works.
The datasource itself is working fine.

Here my query:

{
"request": {
"url": "api/tsdb/query",
"method": "POST",
"data": {
"from": "1610432023688",
"to": "1610432323689",
"queries": [
{
"intervalMs": 60000,
"maxDataPoints": 934,
"rawSql": "UPDATE schema_name.table_name set flag=1 where flag=0",
"format": "table"
}
]
}
}
}

Also tried to reduce it as

{
"queries": {
"rawSql": "UPDATE schema_name.table_name set flag=1 where flag=0",
"format": "table"
}
}

Could you please advice on this?

Many thanks in advance,
best regards,
Emanuele

@speakyourcode
Copy link
Owner

speakyourcode commented Jan 13, 2021

The problem is that you're adding "queries", here is an example to create a database with postgres:

{
   "rawSql":"CREATE DATABASE foo;",
   "format":"table"
}

And to delete it:

{
   "rawSql":"DROP DATABASE foo;",
   "format":"table"
}

I'll add it to the README as an example.

@asnakep
Copy link
Author

asnakep commented Jan 13, 2021

Hello,

many thanks I'll try within an hour

Cheers

@asnakep
Copy link
Author

asnakep commented Jan 13, 2021

Hello,

thanks so much again, it works.
Just made grafana execute commands, scripts and more.

Kind regards
Emanuele

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