Skip to content

Docs for TrueQuery 0.1.6View as Markdown

pre-commit

Add TrueQuery to .pre-commit-config.yaml:

repos:
  - repo: https://github.com/Analytically-ai/truequery
    rev: v0.1.6
    hooks:
      - id: truequery

truequery runs truequery detect on staged .sql files. To check both .sql and .py files (for SQL inside Python files, such as Airflow DAGs and scripts, and for pandas code), use truequery-python:

repos:
  - repo: https://github.com/Analytically-ai/truequery
    rev: v0.1.6
    hooks:
      - id: truequery-python

Exit codes in pre-commit#

  • 0: every staged file was checked and had no findings at or above --fail-on (default error).
  • 1: findings at or above --fail-on.
  • 2: usage or configuration error.
  • 3: no findings at or above --fail-on, but at least one file could not be checked (unparseable SQL, procedural blocks such as PL/pgSQL or BEGIN … END, undecodable text, or files over the 10 MB limit). Passing args: [--allow-unverified] turns exit code 3 into 0 so pre-commit only blocks commits on verified findings.