# 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](https://docs.sqlalchemy.org/en/20/dialects/).
## 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
}
```
Raw data
{
"_id": null,
"home_page": "https://github.com/luke9kim8/sqlfuzz",
"name": "sqlfuzz",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "SOME,MEANINGFULL,KEYWORDS",
"author": "Wooseok Kim",
"author_email": "luke9kim8@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/0e/17/12083e468c8b3233205e900a1d85663e548ba38609e98c7a8f44d3305aa2/sqlfuzz-0.13.5.tar.gz",
"platform": null,
"description": "# SQLFuzz: Random SQLAlchemy Query Generator\n\n`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](https://docs.sqlalchemy.org/en/20/dialects/).\n\n## Install\n\n```\n$ pip3 install sqlfuzz\n```\n\n## Usage\n\n### Quick Start\n\n```\nimport json\nfrom sqlfuzz.fuzz import Fuzz\n\nf = open(\"./path/to/probability/conf.json\")\nprob_conf = json.load(f)\nconnection_string = \"postgresql+psycopg2://{user}:{password}@{host}:{port}/{dbname}\"\nfuzz = Fuzz(prob_conf, connection_string)\n\nqueries = fuzz.gen_orm_queries(count=10)\n```\n\n### Probability Configuration\n\nProbability of the fuzzer chosing to generate a query with following clauses (range: 0-1000)\n\n```\n{\n 'order': 500,\n 'limit': 500,\n 'group': 500,\n 'left': 500,\n 'inner': 500,\n 'full': 500,\n 'scalar': 500,\n 'true': 500,\n 'func_expr': 500,\n 'literal_column': 500,\n 'distinct': 500,\n 'set': 500,\n 'offset': 500,\n 'simple': 500,\n 'window': 500,\n 'extractyear': 500,\n 'extractmonth': 500,\n 'subquery': 500,\n 'nested': 500\n}\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Random Sqlalchemy Query Generator",
"version": "0.13.5",
"split_keywords": [
"some",
"meaningfull",
"keywords"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "3762ebea6f1dbb519a7c2ac25622aa34",
"sha256": "5715e01b640f9c93a67d93717567f43e03d07e5e80e9c26e8635aabe8036692b"
},
"downloads": -1,
"filename": "sqlfuzz-0.13.5.tar.gz",
"has_sig": false,
"md5_digest": "3762ebea6f1dbb519a7c2ac25622aa34",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 17955,
"upload_time": "2022-12-01T19:28:56",
"upload_time_iso_8601": "2022-12-01T19:28:56.563272Z",
"url": "https://files.pythonhosted.org/packages/0e/17/12083e468c8b3233205e900a1d85663e548ba38609e98c7a8f44d3305aa2/sqlfuzz-0.13.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-01 19:28:56",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "luke9kim8",
"github_project": "sqlfuzz",
"lcname": "sqlfuzz"
}