Search code examples
google-bigquerygoogle-cloud-datalab

recommended syntax for comments inside datalab %%sql module?


I had written a fairly complex %%sql module composed of 3 separate queries (the 3rd query calls the first two), and everything was working fine. I went back to add descriptive comments in order to clarify what was being done (since this is material for a tutorial), and now my third query will not work because the comment lines are being wrapped together with subsequent non-comment lines -- more precisely, parts of the original sql are getting merged into the preceding comment line and thereby being removed from the sql.

Should I just completely avoid putting comments inside the %%sql module or is there a proper syntax that would allow this to work? (or should gcp.bigquery.Query() intelligently strip out comments before passing sql on to BigQuery?)


Solution

  • I would avoid comments. You could split the queries across multiple cells and use markdown cells in between.

    We used to support comments starting with '#' in the first column but that has been removed.