treat query files as entire scripts or multiline queries#246
treat query files as entire scripts or multiline queries#246vicenteg wants to merge 2 commits intoGoogleCloudPlatform:devfrom
Conversation
Read all lines in the query file, and join them to create a single query or script.
Codecov Report
@@ Coverage Diff @@
## dev #246 +/- ##
=========================================
Coverage 83.01% 83.01%
Complexity 203 203
=========================================
Files 34 34
Lines 1101 1101
Branches 66 66
=========================================
Hits 914 914
Misses 178 178
Partials 9 9
|
|
Query files by design expect to contain 1 query per line as multiple queries (forming a workload) will usually be included in one file, the proposed change defeats the purpose of the query file. If you'd like to implement something like this you'd need to have a parsing scheme that identifies whether a line represents a complete query or an unfinished query and adjust parsing accordingly. |
|
Thanks for looking at this.
Here's an example of how I've been configuring workloads: Is this not equivalent to having a single query file with multiple queries? One query per line makes complex queries and scripts much harder to read, and it requires pre-processing of the query to remove newlines. While this is not necessarily hard to do, it does represent friction.
Parsing SQL is non-trivial and BigQuery already parses SQL. I'd suggest that a query file's contents should be passed to BigQuery unmodified, so that BigQuery can do the parsing. This is especially important since people may want to test scripts, which are very naturally multiple line files and should be interpreted by BigQuery and not the tool submitting the script. Diverging from the precedent set by Thanks for the consideration! --vince |
Fixes #244
Read all lines in the query file, and join them to create a single
query or script.