sql-fingerprint

Crates.iosql-fingerprint
lib.rssql-fingerprint
version1.9.0
created_at2025-04-02 21:30:23.56684+00
updated_at2025-07-31 09:05:27.430065+00
descriptionA SQL fingerprinter.
homepage
repositoryhttps://github.com/adamchainz/sql-fingerprint
max_upload_size
id1617247
size34,031
Adam Johnson (adamchainz)

documentation

README

sql-fingerprint

Documentation Changelog CI Crates.io pre-commit

A SQL fingerprinter.

sql-fingerprint reduces SQL queries to recognizable fingerprints for easier comparison. The goal is to provide readable traces from queries captured during tests, so that changes can be tracked over time.

For example, given a query like:

SELECT name, age /* computed */ FROM cheeses WHERE origin = 'France'

…it will output a fingerprint like:

SELECT ... FROM cheeses WHERE ...

The fingerprinting process applies these changes:

  • Comments are dropped.
  • Whitespace is normalized to a single space.
  • Identifier and value lists are reduced to '...'.
  • Identifiers consisting of letters, numbers, and underscores have any quoting removed.
  • Savepoint IDs are replaced with 's1', 's2', etc.
  • Unparsable SQL is returned unchanged.
Commit count: 33

cargo fmt