[sqlfluff]
dialect = postgres
templater = jinja
max_line_length = 120
library_path = sqlfluff_libs/libs
# AM04: ambiguous column count in a SELECT * (n/a, we always name columns).
# LT02/LT03/LT05/LT14/CV06/CV07/CP01: pure layout/formatting rules that
# fight the compact-but-valid whitespace real Jinja for-loops produce
# (e.g. a comma-joined column list rendered on one line). These templates'
# actual SQL correctness is verified empirically by the test suite
# executing every one of them against real Postgres, not by sqlfluff.
exclude_rules = AM04, LT02, LT03, LT05, LT14, CV06, CV07, CP01

[sqlfluff:templater:jinja:context]
tenant_schema = public
view_name = person_view
base_table = person
function_name = person_view_instead_of_update
pk_column = id
pk_default_expr = nextval('"public"."person_id_seq"')
columns = ["id", "first_name", "age"]
# An OverlayUniqueConstraint's condition and the columns it reads, so
# unique_constraint_trigger.sql.j2 renders its conditional branches.
watched_columns = ["first_name", "age"]
condition = age > 0
anti_join = full
# A redundant-update policy that renders the guard, for instead_of_update.sql.j2.
redundant = {"guarded": True, "mode": "warn", "scope": "source_only", "ignored_columns": ["age"]}
compared = ["id", "first_name"]
trigger_name = overlayfk_note_person_id
referencing_table = note
column = person_id
table_name = note
negate = True
source = {"schema": "public", "table": "personsource", "id_column": "id", "extra_where": "", "negate": True}
target_tables = [{"schema": "public", "table": "person", "id_column": "id", "negate": False}, {"schema": "public", "table": "personsource", "id_column": "id", "negate": True}]
origin_column = _overlay_origin
origin_base = base
origin_source = source
pk_sequence = person_id_seq
descending = True
referencing_pk = id
target_pk = id
target_table = person
target_view = person_view
# A declared partition key, so referenced_row_trigger.sql.j2 renders the pruning
# branch rather than dying on `Undefined | qi`.
partition_key = state
# The two sources a swap compares, and the natural key it compares them on.
current = {"schema": "public", "table": "personsource", "id_column": "id", "extra_where": "", "negate": True}
candidate = {"schema": "public", "table": "personsource_green", "id_column": "id", "extra_where": "", "negate": True}
identity_columns = ["first_name"]
