├── MANIFEST.in ├── Makefile ├── README.md ├── setup.py └── visql ├── __init__.py └── main.py /MANIFEST.in: -------------------------------------------------------------------------------- 1 | recursive-include visql * 2 | global-exclude *.pyc 3 | global-exclude *~ 4 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | sdist: 2 | rm -rf dist 3 | cp README.md README 4 | python setup.py sdist 5 | ls -l dist/visql*.tar.gz 6 | sleep 5 7 | cd dist && mkdir tmp && cd tmp && tar xzvf ../visql*.tar.gz && cd visql*[0-9] && ./setup.py build 8 | python setup.py sdist 9 | twine upload dist/visql*.tar.gz 10 | rm -rf dist 11 | rm README 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | visql 2 | === 3 | 4 | Edit slices of SQL tables in vi. Just specify a table and any filters 5 | you want to apply, and the table will show up in vi in csv format. 6 | Any edits you make will be applied back to the original source. 7 | 8 | ![demo](https://user-images.githubusercontent.com/118367/31579274-e3cc78b4-b100-11e7-88a2-63be8a358dbb.gif) 9 | 10 | ## Install 11 | 12 | To edit local Sqlite databases, just do: 13 | 14 | ``` 15 | pip install visql 16 | ``` 17 | 18 | For PostgreSQL or MySQL support, add `catsql[postgres]` or `catsql[mysql]`: 19 | 20 | ``` 21 | pip install visql catsql[mysql] 22 | pip install visql catsql[postgres] 23 | ``` 24 | 25 | For other databases, just install the appropriate [SQLAlchemy dialect](http://docs.sqlalchemy.org/en/latest/dialects/index.html). 26 | 27 | ## Use 28 | 29 | ``` 30 | visql test.sqlite3 31 | visql test.sqlite3 --table users 32 | visql postgres[ql]://user:pass@host/db --table users 33 | visql mysql://user:pass@host/db --table users 34 | visql test.sqlite3 --table users --grep paul 35 | visql test.sqlite3 --table comments --sql "length(txt) < 40" 36 | ``` 37 | 38 | For all filters, see https://github.com/paulfitz/catsql#examples 39 | 40 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | from setuptools import setup 5 | 6 | install_requires = [ 7 | "catsql >= 0.4.1" 8 | ] 9 | 10 | if sys.version_info[0] == 2: 11 | install_requires.append('unicodecsv') 12 | 13 | setup(name="visql", 14 | version="0.1.1", 15 | author="Paul Fitzpatrick", 16 | author_email="paulfitz@alum.mit.edu", 17 | description="Edit a slice of a SQL database in vi", 18 | packages=['visql'], 19 | entry_points={ 20 | "console_scripts": [ 21 | "visql=visql.main:main" 22 | ] 23 | }, 24 | install_requires=install_requires, 25 | url="https://github.com/paulfitz/visql" 26 | ) 27 | -------------------------------------------------------------------------------- /visql/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulfitz/visql/715bfa6ff4e9a200b25ccda73255a038e549e374/visql/__init__.py -------------------------------------------------------------------------------- /visql/main.py: -------------------------------------------------------------------------------- 1 | from catsql.main import edit 2 | 3 | 4 | def main(): 5 | edit('vi') 6 | --------------------------------------------------------------------------------