Skip to main content

SQL job pack for Tessera: lint SQL files/migrations into a statement and table catalog.

Project description

tesserakit-sql

Lint SQL files and migrations into a statement and table catalog.

tessera-sql parses .sql files with lightweight heuristics (no database connection, no execution), builds a catalog of statements and declared tables, and flags high-signal migration-safety issues.

Lint SQL

tessera sql lint --input migrations/ --output ./out/sql_pack
tessera sql lint --input schema.sql --output ./out/sql_pack

Artifacts written:

statements.jsonl         one SqlStatement per parsed statement (kind, target, flags)
tables.jsonl             one SqlTable per CREATE TABLE (columns, primary-key flag)
index.md                 statement catalog
validation_report.md     safety findings
coverage_report.md       statement-kind distribution
tables.md                table catalog with columns and PK status

Lint rules

Query safety:

  • delete_without_where (error) — DELETE with no WHERE removes every row
  • update_without_where (warning) — UPDATE with no WHERE writes every row
  • select_star (info) — SELECT * couples the query to column shape

Migration safety (the costly, easy-to-miss class):

  • add_not_null_without_default (error) — ALTER TABLE ... ADD COLUMN ... NOT NULL with no DEFAULT rewrites the table and fails on existing rows
  • truncate_table (warning) — TRUNCATE wipes all rows and is often non-transactional / irreversible
  • drop_column (warning) — dropping a column is destructive and irreversible
  • rename_breaks_compatibility (warning) — RENAME breaks code referencing the old name; prefer add-new + backfill + drop-old
  • drop_without_if_exists (warning) — DROP without IF EXISTS fails if the object is absent
  • create_table_without_if_not_exists (info) — non-idempotent if the migration re-runs

Schema:

  • table_without_primary_key (warning) — a CREATE TABLE declares no PRIMARY KEY
  • no_statements — nothing parsed

Limitations (v0.1)

Parsing is heuristic: comments are stripped, statements are split on top-level semicolons (quote-aware), and classification is keyword/regex based. It is tuned for migration and schema files, not for validating arbitrary vendor SQL dialects.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tesserakit_sql-0.4.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tesserakit_sql-0.4.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file tesserakit_sql-0.4.0.tar.gz.

File metadata

  • Download URL: tesserakit_sql-0.4.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for tesserakit_sql-0.4.0.tar.gz
Algorithm Hash digest
SHA256 5272d4513c911ac956a3cd3e5553bd0cfb5ece8d7b6514fcb2d0b78acb4b276c
MD5 bbaa0a5606d5ca43c937ecedf978301e
BLAKE2b-256 da07f1020f9dbb230079260e09ecb2f6f615989568bcadbe9056da967ac26522

See more details on using hashes here.

File details

Details for the file tesserakit_sql-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: tesserakit_sql-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for tesserakit_sql-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9f21cb70c7d261a31f98b678b60ea350d3e36ed80002b2daa16b68d8b72a50f4
MD5 d391efdfd9ea8fa53f45e983ff1a54c3
BLAKE2b-256 a45b12ce777a0dece28b6ab3a3230ae77b37f8c1bddc465d689cd51422d99b58

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page