Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jongha/spgen
Stored Procedure Generator. spgen is Stored Procedure Generator for MySQL. It's a Python script. It auto generates Stored Procedure which includes add, update, delete functions from existing tables.
https://github.com/jongha/spgen
generator mysql python python-script
Last synced: 22 days ago
JSON representation
Stored Procedure Generator. spgen is Stored Procedure Generator for MySQL. It's a Python script. It auto generates Stored Procedure which includes add, update, delete functions from existing tables.
- Host: GitHub
- URL: https://github.com/jongha/spgen
- Owner: jongha
- License: mit
- Created: 2013-12-12T00:54:14.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-07-17T05:22:28.000Z (over 9 years ago)
- Last Synced: 2024-10-04T17:47:39.958Z (about 1 month ago)
- Topics: generator, mysql, python, python-script
- Language: Python
- Homepage: https://pypi.python.org/pypi/spgen
- Size: 155 KB
- Stars: 9
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Stored Procedure Generator
[![Build Status](https://travis-ci.org/jongha/spgen.png?branch=master)](https://travis-ci.org/jongha/spgen)spgen is Stored Procedure Generator for MySQL. It's a Python script. It auto generates Stored Procedure which includes add, update, delete functions from existing tables.
## Requirements
The program requires Python 2.x or Python 3.x.
You must install a [MySQL connector for python](http://dev.mysql.com/downloads/connector/python/).## Usage
### From the command line
usage: spgen.py [-h] [-P PORT] [-u USER] [-p PASSWORD] [-d] host database [tables [tables ...]]
$ spgen.py -uim -ppw localhost mydb table1 table2
positional arguments:
host Host to connect.
database Database name.
tables Table name. e.g table1 table2optional arguments:
-h, --help show this help message and exit
-P PORT, --port PORT Port number to use for connection or 0 for default.
-u USER, --user USER User for login.
-p PASSWORD, --password PASSWORD Password to use when connection to server.
-d, --debug Set Debug mode.### Using a Library
Check out the run.py file.
```
from spgen.spgen import Spgentry:
spgen = Spgen()
spgen.connect(
host = 'IP address',
database = 'database name',
tables = ['table1', 'table2'],
port = 3306,
user = 'user name',
password = 'user password');spgen.build(debug=False) # debug argument is option
spgen.close()exit(1)
except:
exit(0)
```## License
spgen is available under the terms of the MIT License.