BlogsShopifyShopifyQL Commerce Data Querying Language

ShopifyQL Commerce Data Querying Language

ShopifyQL Commerce Data Querying Language

2
posts
2022–2023

ShopifyQL is an accessible, commerce-focused querying language used on both the client and server, defined by an ANTLR grammar and used to generate code for multiple targets (Go, Typescript). It is used to power ShopifyQL Notebooks, providing merchants with a guided code editing experience. The language features are encapsulated into a TypeScript language server conforming to the Language Server Protocol (LSP). This enables interoperability with code editors like CodeMirror, which uses its own Lezer parser engine. A custom adapter was developed to translate between the LSP-compliant language server and Lezer, handling complex token offset calculations from ANTLR to a CodeMirror-compatible format. This integration allows for features like syntax highlighting, code completion, linting, and tooltips within the ShopifyQL code editor, enhancing the merchant experience for data analysis.

2023

Building a ShopifyQL Code Editor - Shopify

9/11/2023

This post details the technical implementation of integrating the ShopifyQL language server with the CodeMirror editor. Key contributions include: developing a custom adapter to bridge the Language Server Protocol (LSP) and CodeMirror's Lezer parser, solving complex token offset calculations from ANTLR's incremental, relative positioning to CodeMirror's document-relative offsets, and implementing a `TokenIterator` class to manage this conversion. It also describes how the language server's features (completion, linting, hover tooltips) were connected to CodeMirror plugins via the custom adapter.

2022

Introducing ShopifyQL: Our New Commerce Data Querying Language  - Shopify

6/22/2022

Introduces ShopifyQL, a new domain-specific language for commerce data querying. Highlights its accessible syntax, built-in visualization capabilities, native period comparisons (e.g., year-over-year), and commerce-specific date range filtering (e.g., BFCM). Explains the rationale behind its development, addressing the limitations of traditional SQL for non-technical users and the challenges of centralized data teams. Details the syntax structure and key keywords like SHOW, VISUALIZE, COMPARE TO, and DURING. Mentions the development of exploration data models for products, orders, and customers.