From 3cb6e2baa6dd370c3f5a5e066c11f807159c1644 Mon Sep 17 00:00:00 2001 From: zhangysh1995 Date: Mon, 14 Sep 2020 15:30:55 +0800 Subject: [PATCH] update --- README.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/README.md b/README.md index d95f948..8faf33a 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,51 @@ # gensql Python package to generate random simple ddls and queries with a brute-force approach + +## Description + +### Summary +This is a standalone database and query generation tool. +* Features: table, data and query generation +* Language: `Python 3` +* Dialects: mainly `MySQL` + +### Usage +You could see the tests unders `./sqlgen/test` for examples. Generally, we have: +* A database generator: `./sqlgen/gentable` +* A SQL generator: `./sqlgen/gensql` +* A general driver to connect different databases `driver.py` +````Bash +usage: driver.py [-h] [-D {mysql,mariadb,tidb,postgres,sqlite,timescale}] + [-H HOST] [-P PORT] [-u USER] [-p PASSWORD] [-d DATABASE] + +optional arguments: + -h, --help show this help message and exit + -D {mysql,mariadb,tidb,postgres,sqlite,timescale}, --driver {mysql,mariadb,tidb,postgres,sqlite,timescale} + database server + -H HOST, --host HOST host + -P PORT, --port PORT port + -u USER, --user USER the user to connect the database + -p PASSWORD, --password PASSWORD + password + -d DATABASE, --database DATABASE + use the given database. Need file path if connecting + to sqlite. +```` +## Tests +````Bash +python3 -m unittest discover +```` + +## Dependencies +* Python (>= 3.7)) +* moz-sql-parser (dev branch only) + * For MySQL, it is better to use [customized version](https://github.com/zhangysh1995/moz-sql-parser) +* Database drivers + * MySQL: `mysql-connector-python` (>= 8.0.19) + +## Contributions +If you want to improve this tool, you could start from the following lists: +* Refactor + * Hard-coded generation rules in `./sqlgen/gen*` +* Unit tests + * Check `./sqlgen/test` \ No newline at end of file