Skip to content

Instantly share code, notes, and snippets.

@abitrolly
Created September 27, 2019 11:16
Show Gist options
  • Save abitrolly/253c00c0238e284e9c9dc31e8dec49d4 to your computer and use it in GitHub Desktop.
Save abitrolly/253c00c0238e284e9c9dc31e8dec49d4 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
# Code for drawing a lot of SQLite databases
# https://github.com/yakshaveinc/linux/issues/29#issuecomment-533082911
import os
import sqlite3
from urllib.request import pathname2url
from sqlalchemy_schemadisplay import main
files = open('../sqlites.find').read().splitlines()
numwidth = len(str(len(files)))
for i, path in enumerate(files):
# TODO sanitize filename or just use numbers
inpath = 'sqlite:///' + path # pathname2url(path)
outpath = f'{i+1:0{numwidth}}.{os.path.basename(path)}.png'
print(inpath)
try:
main(inpath, outpath)
except Exception as exc: #sqlite3.OperationalError as exc:
print('!!! Exception occured')
print(exc)
input('Press Enter to continue...')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment