This is a python script that lets users quickly view their database table schema. I wrote this as a simple way to quickly view my database table columns.
pip install git+https://github.com/rrickgauer/tables.gitTo see a list of all your connections:
tables listTo add a new connection:
tables addTo delete a connection:
tables deleteTo view the tables of a connection:
tables viewThere are several different options for viewing a database schema.
List all tables and views:
tables view -n connection_nameDump schemas of both tables and views:
tables view -n connection_name [-a,--all]Dump schemas of tables:
tables view -n connection_name [-t,--tables]Dump schemas of views:
tables view -n connection_name [-v,--views]To write the output to a file, you can use the -o,--output flag:
tables view -n connection_name --output /desktop/tables-output.txtYou can specify the format of the output by using the -f,--format option:
tables view -n connection_name {-f,--format} format_valueCurrently, there are 4 options you can choose from:
- table (default)
- markdown
- html
- json
This script stores the data needed to access your mysql database onto a file called .tables.config. It is located the same directory as the tables.py. If the configuration file does not exist, the script will prompt the user to enter info needed to connect to the database. The info is stored as plain text, so if you are worried about having your password, username, host, or database name stored on a plain text file, this is not the right option for you. I added .tables.config to the .gitignore file so the configuration file will never be accidentally pushed onto a public repo.
Pull requests are welcome!