Giter Club home page Giter Club logo

devtool-db-introspection's Introduction

Database Introspection Tool

Open-Source developers tool that provides simple helpers for legacy databases introspection. Crafted on top of Python and Peewee.


Features

  • Peewee DB Reflection
  • Supported DB:
    • SQLite, MySql, PostgreSQL
  • DbWrapper Class:
    • print_all_models() - returns all tables
    • print_db_model - print table definition
    • dump_tables() - Dump SQL definitions (all tables)
    • dump_tables_data() - Dump database content (all tables)

Support via Github (issues tracker) and Discord.


DB Migration Tool - Open-Source Developer Tool provided by AppSeed.


โœจ Quick Start

Clone Sources (this repo)

$ git clone https://github.com/app-generator/devtool-db.git
$ cd devtool-db

Install Modules using a Virtual Environment

$ virtualenv env
$ source env/bin/activate
$ pip install -r requirements.txt

Or for Windows-based Systems

$ virtualenv env
$ .\env\Scripts\activate
$
$ # Install modules - SQLite Database
$ pip3 install -r requirements.txt

Launch the Python console

$ python
>>> 
>>> from util import *                                  # import helpers      
>>>                    
>>> db_sqlite = DbWrapper()                             # invoke the Base Class  
>>> db_sqlite.driver = COMMON.DB_SQLITE                 # set driver
>>> db_sqlite.db_name = 'samples/api-django.sqlite3'    # set db name
>>> db_sqlite.connect()                                 # connect 
True 
>>> db_sqlite.load_models()                             # load DB SChema 
True
>>> db_sqlite.dump_tables()                             # Dump tables definitions 
True
>>> db_sqlite.dump_tables_data()                        # Dump data
 > Dump data for [api_user_user]
 > Dump data for [api_authentication_activesession]
 > Dump data for [auth_group]
 > Dump data for [api_user_user_groups]
 > Dump data for [django_content_type]
 > Dump data for [auth_permission]
 > Dump data for [api_user_user_user_permissions]
 > Dump data for [auth_group_permissions]
 > Dump data for [django_admin_log]
 > Dump data for [django_migrations]
 > Dump data for [django_session]
True
>>> db_sqlite.reset()                                     # reset the Class data  
>>>

At this point, the tables and data are saved in the output directory.

$ cd output ; ls 
$ SQLITE.sql
$ SQLITE_api_user_user.sql
$ SQLITE_auth_permission.sql
$ SQLITE_django_content_type.sql
$ SQLITE_django_migrations.sql


Database Introspection Tool - Provided by AppSeed App Generator.

devtool-db-introspection's People

Contributors

app-generator avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

leadpiggy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.