20 lines
468 B
Python
20 lines
468 B
Python
#!/usr/bin/env python3
|
|
import json
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
|
|
def main(path: str) -> None:
|
|
payload = json.loads(Path(path).read_text(encoding='utf-8'))
|
|
for table, rows in payload.items():
|
|
print(f'-- {table}: {len(rows)} rows')
|
|
for row in rows[:2]:
|
|
print(row)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
if len(sys.argv) != 2:
|
|
print('Usage: sqlite_preview.py <export-json>')
|
|
raise SystemExit(1)
|
|
main(sys.argv[1])
|