Docs /SQL Editor /Code navigation
SQL EditorNavigation

Code navigation

The editor resolves every name in your query (CTEs, aliases, columns, tables), so it can jump to where a thing is defined, list every place it's used, rename it everywhere at once, and tell you what it is when you hover.

hover a column
12345678910
WITH failed_tests AS (
SELECT
  vehicle_id,
  make,
  completed_date
FROM `ace-analytics.warehouse.fact_mot_test`
WHERE test_result = 'FAILED'
)
SELECT f.vehicle_id, f.make
FROM failed_tests AS f
vehicle_id
TypeSTRING
Sourcefact_mot_test
NullableNo

Keyboard shortcuts

ActionKeysAlso
Go to DefinitionF12⌘-click (Ctrl-click on Windows and Linux); right-click → Go to Definition
Go to References⇧F12 (ShiftF12 on Windows and Linux)right-click → Go to References
Rename SymbolF2right-click → Rename Symbol
Peek Definition⌘F12 (CtrlF12 on Windows and Linux)

Go to Definition only appears in the right-click menu when the cursor is on a name the editor can resolve.

Go to Definition

What happens depends on what the name is:

  • A name defined in the query (a CTE, a table or column alias, a temp table, a pipe-syntax alias, a graph variable or label): the cursor moves to the definition. F12 again on an alias declaration goes on to the CTE or table behind it.
  • A schema table or column: opens the table in the schema tree (for a column, its Schema tab with that column highlighted). A table you can’t access shows a warning.
  • A function or a DECLARE variable: nothing.

Works the same in dbt and Dataform files; inside a Jinja expression nothing resolves.

Go to References

⇧ F12 (Shift F12 on Windows and Linux) opens the references peek under the line: every occurrence, definition included, click to jump.

12345678
WITH user_stats AS (
SELECT user_id, COUNT(*) AS n
FROM `ace-analytics.warehouse.events`
GROUP BY user_id
)
SELECT * FROM user_stats
UNION ALL
SELECT * FROM user_stats
Go to References on user_stats lists three locations: the definition and both FROM clauses.

References are found for CTEs, table aliases, column aliases, temp tables, pipe aliases, graph variables, and schema columns (every use of vehicle_id from that table, qualified or not). For a CTE the list also includes its aliases and their alias.column uses. Schema tables and functions have no reference search.

Rename

F2 on a CTE, a table alias, a column alias, a temp table, a pipe alias or a graph variable renames the definition and every reference in the current editor. A CTE rename leaves aliases pointing at it alone (FROM failed_tests AS f keeps f).

Schema tables, schema columns, functions and query parameters can’t be renamed; F2 on them does nothing, silently.

Hover

Every resolvable identifier shows a Property / Value card: type, source and nullability for a column; row count, partitioning, clustering and a column list for a table; the defining line for a CTE; parameters and return type for a function.

hover a table
12
SELECT vehicle_id, completed_date
FROM `ace-analytics.warehouse.fact_mot_test`
ace-analytics.warehouse.fact_mot_test
TypeTable
Rows41,203,118
Partitioned Bycompleted_date (MONTH)
Clustered Byvehicle_id, test_result, make

MOT test fact table.


mot_test_id: STRING · vehicle_id: STRING · completed_date: DATE · completed_timestamp: TIMESTAMP · expiry_date: DATE? · test_result: STRING

When column lineage knows the position, the card gains Derives from and Side inputs rows. Signature help for functions is covered in auto-completions.

Inlay hints

Gray annotations in the code, no hover needed:

12345
SELECT make, test_result, COUNT(*) AS tests
FROM `ace-analytics.warehouse.fact_mot_test` AS t
JOIN `ace-analytics.warehouse.dim_vehicle` AS v USING (vehicle_id)
GROUP BY 1, 2
ORDER BY 3 DESC ← tests
  • GROUP BY 1, ORDER BY 2, PARTITION BY 1 → ← column after the number (alias if there is one, else the expression).
  • GROUP BY ALL → ← make, test_result, the columns it will group by.
  • Unqualified columns in a query with JOINs → [t.] before the column, so you can see which table it came from.
  • ROWS BETWEEN 2 PRECEDING AND CURRENT ROW → ← 3 rows total.
  • -- querylab:tablesample=1 → TABLESAMPLE 1% after each table that will be sampled; see TABLESAMPLE.
  • In dbt and Dataform files, the compiled table name after ref(), source(), resolve().

Settings → Editor → SQL Editor → Inlay Hints (also listed under Settings):

Inlay Hints
⌃
Show column position hintsDisplay which column a GROUP BY, ORDER BY, or PARTITION BY position number refers to (e.g., ← user_id)
Show table & window hintsDisplay the source table for ambiguous JOIN columns, and the total row count for window frames
Show variable typesDisplay inferred types for columns and variables (e.g., : INT64)

The dbt and Dataform hints have their own switches under Settings → SQL Frameworks.