Skip to content

cargo sqlx prepare produces non-deterministic files #4339

Description

@nyurik

I have found these related issues/pull requests

none

Description

Every time I run cargo sqlx prepare ..., it generates equivalent content of the .sqlx/query-*.json files that I check into the repo, but the order of the keys is random. This adds an extra complexity when managing the project.

Please consider using JSON sorting for the keys when saving metadata files.

Reproduction steps

Run this type of command multiple times, and observe that each time produces different results (observed in https://github.com/maplibre/martin repo)

cargo sqlx prepare --database-url sqlite://$PWD/../tests/fixtures/mbtiles/world_cities.mbtiles -- --lib --tests

SQLx version

0.9.0

Enabled SQLx features

"sqlite", "runtime-tokio"

Database server and version

sqlite

Operating system

Linux Mint

Rust version

1.97.0 (2d8144b78 2026-07-07)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions