Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
[Feature Request] Add ability to use existing queries #5
It's challenging to do complex queries that involve multiple JOIN/CROSS APPLY. It would be good for users to have the ability able to seed DBFS with existing queries.
Example monitoring queries
Hi Vin, yes. I 100% agree with you here. Most DBAs have a set of queries they draw from. Even in the case where a sysadmin is involved, it's usually code handed off from the DBA to the sysadmin with a little training on how to use that code.
I reviewed the code and having been thinking about some implementations on how we could do this. First we could put the queries in files in a known location or a more strict list of queries defined in the dbfs configuration file and read them in and execute them when when the dbfs "file" is accessed.
Second, we could implement user views in the database and call them as needed from dbfs files. But which database should we put these views inside SQL Server?
Rather than a narrow focus on user views, why not allow any object that is valid in a
Regarding how / where to discover the objects, here are some thoughts (some better than others as this is just brainstorming). In all cases, the starting point should be an option in the config file. Also, the focus is on objects instead of queries since the infrastructure already is built around handling objects, and it is easy enough for any DBA to put their favorite queries into objects (View or TVF).
Just some thoughts. Interesting project so far :-)
Thanks for contributing to this discussion! We're thinking of adding the ability to allow users to mount a folder of user-defined queries through the DBFS configuration file. Below are scenarios describing how this would work. Let us know what you think.
Setup DBFS to run custom queries
Edit custom query
No need to restart DBFS/modify the configuration file.
Add/Remove queries in folder
user will need refresh the mount directory to see updated files
Custom query has an error