#fuzzer #sql #random #parquet #generate #queries #local

bin+lib sqlfuzz

Generate random (and sometimes valid!) queries from any local Parquet, CSV, JSON, or Avro data set

4 releases (2 breaking)

0.3.0 Jul 10, 2022
0.2.0 Jul 10, 2022
0.1.1 Jul 9, 2022
0.1.0 Jul 9, 2022

#660 in Testing

Apache-2.0

33KB
761 lines

SQL Fuzz Testing Utilities

Generate random (and sometimes valid!) SQL queries from any local datasets in Parquet, CSV, JSON, or Avro format.

Installation

cargo install sqlfuzz

Query Fuzzing

sqlfuzz query \
  --table ./testdata/test0.parquet ./testdata/test1.parquet \
  --join-type inner left right full semi anti \
  --count 5 \
  --max-depth 5

Example Generated Query

SELECT __c320, __c321, __c322, __c323
FROM (
    (SELECT test1.c0 AS __c320, test1.c1 AS __c321, test1.c2 AS __c322, test1.c3 AS __c323
    FROM (test1))
    INNER JOIN
    (SELECT test1.c0 AS __c324, test1.c1 AS __c325, test1.c2 AS __c326, test1.c3 AS __c327
    FROM (test1))
    ON __c320 = __c327)
WHERE __c323 > __c320;

Data Generator

If you don't already have suitable data, you can generate random data files to run the query fuzzer against.

sqlfuzz data --path ./testdata --num-files 4 --row-count 20

Dependencies

~38–51MB
~1M SLoC