Commit 878259a1 authored by aoh's avatar aoh
Browse files

read_sql.py: Cleanup


Signed-off-by: aoh's avataraoh <aoh@lysator.liu.se>
parent d97dd19f
#!/usr/bin/env python3
import pymysql.cursors
from db import DB
connection = pymysql.connect(host='lysns.lysator.liu.se',
user='lysns',
password='hunter2',
db='lysns',
charset='utf8mb4',
cursorclass=pymysql.cursors.DictCursor)
try:
with connection.cursor() as cursor:
print("Domain")
cursor.execute('SELECT id, name, uid, dirtybit, deletebit FROM domain')
print(cursor.fetchone())
print("Record types")
cursor.execute('SELECT id, name FROM record_types')
print(cursor.fetchone())
print("Subdomain")
cursor.execute('SELECT id, name, ttl, class, rr, destination, domainid, dirtybit, deletebit FROM subdomain')
print(cursor.fetchone())
print("Update key")
cursor.execute('SELECT id, subid, update_key, secret FROM update_key')
print(cursor.fetchone())
finally:
connection.close()
print("dump db")
with DB() as d:
for id in d.get_domain_ids():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment