How to easily execute a SQL query against a local dataset
As a tester, I often have to work with data in various formats like .json or .csv. When the data is not in files, but in the database, it is easy to select the necessary information using SQL queries. But what about data in local files?
This is where the dsq utility comes to the rescue which will help you execute SQL queries on datasets in JSON, CSV, Excel, Parquet and many other formats.
For macOS and Linux users, GitHub has detailed instructions for installing and working with it. I will show on the example of Windows how it works.
The first step is to download the binary from the releases page and extract it on your computer. In this case, you must not forget to specify the path to dsq
in $PATH
your PC.
Then you just need to execute a SQL query on the command line to the file you need. For example, this way dsq C:\Temp\dsq-win32-x64-0.2.0\123.csv "SELECT * FROM {} WHERE ID_EMIAS = '23621134';"
you will immediately get the result.
And here is the same line, but when working with Dbeaver.