Mercurial > hg > Lemuriformes
view lemuriformes/count.py @ 15:0d1b8bb1d97b
SQL + data related functionality
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sun, 10 Dec 2017 17:16:52 -0800 |
parents | ad1bf59eedb0 |
children |
line wrap: on
line source
#!/usr/bin/env python """ list SQL table counts """ import sys from .cli import ConfigurationParser from .url2sql import url2sql def main(args=sys.argv[1:]): """CLI""" # parse command line parser = ConfigurationParser(description=__doc__) parser.add_argument('connection', type=url2sql, help="URL of SQL connection") options = parser.parse_args(args) # display table counts connection = options.connection tables = connection.tables() for table in tables: count = connection.count(table) print ("{},{}".format(table, count)) if __name__ == '__main__': main()