Skip to main content

SQLFuzz: Random SQLAlchemy Query Generator

sqlfuzz is a random SQLAlchemy query generator for DBMS fuzzing toolchains. sqlfuzz improves upon other random query generators, such as sqlsmith, by leveraging SQLAlchemy's ability to compile the same query for different DBMS dialects. For example, sqlfuzz allows us to easily test the queries that triggers bugs in Postgres to other DBMSs such as MySQL, MariaDB, Sqlite, etc. sqlfuzz can target any dialects that SQLAlchemy supports.

Install

$ pip3 install sqlfuzz

Usage

Quick Start

import json
from sqlfuzz.fuzz import Fuzz

f = open("./path/to/probability/conf.json")
prob_conf = json.load(f)
connection_string = "postgresql+psycopg2://{user}:{password}@{host}:{port}/{dbname}"
fuzz = Fuzz(prob_conf, connection_string)

queries = fuzz.gen_orm_queries(count=10)

Probability Configuration

Probability of the fuzzer chosing to generate a query with following clauses (range: 0-1000)

{
  'order': 500,
  'limit': 500,
  'group': 500,
  'left': 500,
  'inner': 500,
  'full': 500,
  'scalar': 500,
  'true': 500,
  'func_expr': 500,
  'literal_column': 500,
  'distinct': 500,
  'set': 500,
  'offset': 500,
  'simple': 500,
  'window': 500,
  'extractyear': 500,
  'extractmonth': 500,
  'subquery': 500,
  'nested': 500
}

Metadata

Release files for sqlfuzz 0.13.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sqlfuzz 0.13.5
File Size Uploaded
sqlfuzz-0.13.5.tar.gz 18.0 kB Details

Release files / sqlfuzz-0.13.5.tar.gz

Download URL sqlfuzz-0.13.5.tar.gz
Size 18.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5715e01b640f9c93a67d93717567f43e03d07e5e80e9c26e8635aabe8036692b
BLAKE2b-256 checksum
How to use checksums
0e1712083e468c8b3233205e900a1d85663e548ba38609e98c7a8f44d3305aa2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.8

Release history Release notifications | RSS feed

This release

0.13.5 This release

1 release file

0.13.4

1 release file

0.13.3

1 release file

0.13.2

1 release file

0.13.1

1 release file

0.13

1 release file

0.12

1 release file

0.11

1 release file

0.10

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page