Skip to main content

Automatically maps sql tables and generates classes for ORM manipulation

Project description

Description

Map SQL (MySQl) table(s) and generate ORM classes for them automatically !! This proves to be very useful especially in cases where the number of tables is huge

Demo

From command line

https://cloud.githubusercontent.com/assets/10980285/17341384/f58637a4-5911-11e6-9309-deb9c4ae3dd8.gif

As a python module

https://cloud.githubusercontent.com/assets/10980285/17342191/a87677f4-5915-11e6-8cd1-7060eead65b3.gif

Installation

Using this repository

git clone http://github.com/shravan97/ORM-Creator
cd ORM-Creator
python setup.py install

Using pip

Coming up soon !

Usage

usage: orm-creator [-h] [-db DB] [-t TABLES [TABLES ...]] [-host HOST]
                 [-u UNAME] [-o OUTFILE]

optional arguments:
  -h, --help            show this help message and exit
  -db DB                The name of database from which tables will have to
                      mapped
  -t TABLES [TABLES ...]
                      List of table names each separated by one or more
                      space
  -host HOST            Name of the MySql host For Eg., localhost ,
                      mysql.mydomain.com ,....etc
  -u UNAME              Your Mysql username
  -o OUTFILE            Output file name ,along with its extension and
                      absolute path For Eg. , /home/shravan97/Desktop/out.py

Sample

As a command line app

orm-creator -u root -db demo -t users migrations -o /var/www/flaskApp/db.py

# The above statement maps `users` and `migrations` tables

As a module

from orm_creator import ormCreator
oc = ormCreator(config,'demo',['users','migrations'],'/var/www/flaskApp/db.py')

# config is stored as a dict . For eg. , config = {'uname':'root','password':'**','host':'localhost'}

oc.generate_file()

Please check here

Contributions

Found any cool idea that could be implemented here ? Go ahead and give a pull request :smile: ! You may as well put it up as an issue here

Contributors

License

GNU General Public License v3 (GPLv3)

https://cloud.githubusercontent.com/assets/10980285/16361582/a40f472a-3bb2-11e6-80c4-dd633af6c284.png

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

orm-creator-1.0.0.tar.gz (4.4 kB view details)

Uploaded Source

File details

Details for the file orm-creator-1.0.0.tar.gz.

File metadata

  • Download URL: orm-creator-1.0.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for orm-creator-1.0.0.tar.gz
Algorithm Hash digest
SHA256 de9428fee9d1b399cf023d065d0da5e00f031623351978ebf7fae61e2467c8da
MD5 481dd0a35afd9f398211d7ad8d2e1b82
BLAKE2b-256 2319824d79e7582e86254e77959e29b4d91002a023cde380cc7e3cc4c67bdbe4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page