A select executes a query that returns rows, typically a
SELECT. As the name
suggests, queries should be used for
SELECTing samples of data.
This can be achived with the
run select command:
$ blacksmith run select \ --integration warehouse \ --file ./warehouse/selects/demo.sql Compiling & Running queries: -> Compiling & Running ./warehouse/selects/demo.sql... Success!
This command runs the content of the file
demo.sql, which must be a SQL query
Running a template directly against your database without knowing the compiled
query can be tedious. We strongly advise to first use the
which compiles the SQL file under a new file named
file is located at the same path than the template one.
If we want to make the same run as the previous one but much more safely, we first
compile the SQL file using the
$ blacksmith run select \ --integration warehouse \ --file ./warehouse/selects/demo.sql \ --dry-run Compiling queries: -> Compiling ./warehouse/selects/demo.sql... Success!
$ blacksmith run select \ --integration warehouse \ --file ./warehouse/selects/demo.sql \ --csv --json Compiling & Running queries: -> Compiling & Running ./warehouse/selects/demo.sql... Writing CSV at ./selects/warehouse/demo.csv... Writing JSON at ./selects/warehouse/demo.json... Success!
If you notice something we've missed or could be improved on, please follow this link and submit a pull request to the repository. Once we merge it, the changes will be reflected on the website the next time it is deployed.
Thank you for your contributions!