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

Add possibility for execute multiple sql statement. #95

Open
yeborisov opened this issue Oct 7, 2021 · 2 comments
Open

Add possibility for execute multiple sql statement. #95

yeborisov opened this issue Oct 7, 2021 · 2 comments

Comments

@yeborisov
Copy link

If we want to execute a query after creating a table and add information to it along with deleting the table, we will pass to the sql property in the config yaml file a several SQL statements separate by semi colon. Currently this is not possible.
Some queries for monitoring purpose requires pre processed operations to be done along with post ones.

In the query_exporter.db.DataBase.execute_sql method we can distinguish the given sql is it multiple or not and based on that to perform single or multiple execution where the multiple one must be in one thread.

@albertodonato
Copy link
Owner

You should be able to create a stored procedure which performs the necessary queries and returns the query result, so that you then only need to select * from procedure() as query.

@yeborisov
Copy link
Author

For most of the scenarios yes. But if the user wants to make more than one query against not consistent DB where additional create and drop statements are required, currently it is not possible. Another approach is to insert a priority in each query block and based on it to execute all of the defined queries in consequential way.

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

2 participants