#3331·evidence

`evidence tables` / `evidence schema` fail on BigQuery: `rows` is a reserved keyword

Author: saghatelianCreated Sep 8, 2026Updated Sep 8, 2026

Summary

evidence tables and evidence schema always fail against a BigQuery direct connector. The introspection query aliases a column to rows, which is a reserved keyword in BigQuery, so the query never parses.

Environment

  • Evidence CLI v0.9.3 (evidence upgrade confirms this is the latest)
  • macOS 15.6 / arm64
  • BigQuery direct connector via local connection.yaml (not logged in to Studio)

Steps to reproduce

connection.yaml:

yaml
type: bigquery
project: my-project
keyfile: ./sa-key.json
location: EU
dataset: my_dataset
datasets:
  - my_dataset
bash
evidence tables

Actual

Syntax error: Unexpected keyword ROWS at [1:66]

evidence schema fails identically.

Cause

The CLI builds this query for the bigquery case:

sql
SELECT table_id AS name, dataset_id AS schema_name, row_count AS rows
FROM `<project>`.`<dataset>`.__TABLES__ ORDER BY table_id

rows is a BigQuery reserved keyword. Character 66 is exactly where rows begins.

Confirmed by running both forms by hand:

$ evidence query "SELECT table_id AS name, dataset_id AS schema_name, row_count AS rows FROM \`p\`.\`d\`.__TABLES__"
Syntax error: Unexpected keyword ROWS at [1:81]

$ evidence query "SELECT table_id AS name, dataset_id AS schema_name, row_count AS \`rows\` FROM \`p\`.\`d\`.__TABLES__ LIMIT 3"
{"name":"ad_group","schema_name":"my_dataset","rows":0}
...

Suggested fix

Backtick the alias in the BigQuery branch:

sql
SELECT table_id AS name, dataset_id AS schema_name, row_count AS `rows` FROM ...

The ClickHouse branch (total_rows AS rows) is fine — ClickHouse does not reserve rows.

Impact

Low severity but no workaround: the query is compiled into the CLI binary, so it cannot be overridden from config. Page rendering is unaffected — only the table-listing commands and anything downstream of them.

Possibly related

__TABLES__ only reflects tables and views with a materialized row_count; views report 0. If the intent is to list views too, INFORMATION_SCHEMA.TABLES may be a better source.