Skip to main content

Comments

Comments are notes that you add to a ShopifyQL query. ShopifyQL ignores them when it runs the query, so they don't change the results. Use them to document what a query does or to stop part of it from running while you test.

Syntax

-- line comment

/* block comment */

Comments can explain sections of a query or prevent execution of query text.

Anchor to line comment
line comment
-- comment

Starts with -- and ends at the end of the line.

Anchor to block comment
block comment
/* comment */

Starts with /*, ends with */, and can span multiple lines.


Use a line comment to leave a short note next to a clause, or to disable a single line while you test a query.

Examples

ShopifyQL

FROM sales
SHOW net_sales_with_cost_recorded, cost_of_goods_sold, gross_profit
WHERE cost_is_recorded = true -- Drop sales with no recorded cost so margin isn't overstated
TIMESERIES day
SINCE startOfMonth(0m) UNTIL today
VISUALIZE gross_profit TYPE table

Use a block comment for a longer note, such as what a saved query is for or who maintains it, or to disable several lines at once. A block comment can sit anywhere in a query, not just at the top.

Examples

ShopifyQL

/*
Powers the weekly growth review.
Owned by the analytics team. Check before changing the date range.
*/
FROM sales
SHOW customers, orders, total_sales
WHERE new_or_returning_customer = 'New'
TIMESERIES day WITH TOTALS, PERCENT_CHANGE
SINCE startOfDay(-30d) UNTIL today
COMPARE TO previous_period
ORDER BY day ASC
LIMIT 1000
VISUALIZE customers TYPE line

Was this page helpful?