GQL ↔ SQL

Translate BigQuery graph queries to SQL and back. Runs entirely in your browser. · Docs →

What is GQL in BigQuery?

GQL is BigQuery's syntax for property graphs. A query describes a pattern of nodes and edges instead of a chain of joins. You define the graph once with CREATE PROPERTY GRAPH, then query it with GRAPH, MATCH and RETURN.

The same query in both forms

GQL
GRAPH FinGraph
MATCH (sender:Person)-[t:Transfers]->(receiver:Person)
FILTER t.amount > 500
RETURN sender.name AS sender, receiver.name AS receiver, t.amount
Standard SQL
SELECT p1.name AS sender, p2.name AS receiver, t.amount
FROM Person AS p1
JOIN Transfers AS t ON p1.id = t.source_id
JOIN Person AS p2 ON t.dest_id = p2.id
WHERE t.amount > 500

Why convert GQL to SQL?

The join form shows which tables a graph query reads, which helps when you review or debug one. The schema DDL in the converter is editable, so you can try your own graph definition.

Read more in graph queries in Querylab.io.