Export sorted

This commit is contained in:
2022-11-15 13:38:38 +01:00
parent 4fc2def77c
commit c5dc929de5

View File

@ -38,8 +38,11 @@ if __name__ == '__main__':
tbls = tbls.fetchall()
for file, _, t_name, t_type, _ in tbls:
print(t_name)
cur.execute(f"SELECT * FROM {t_name};")
print([(t[0], t[1]) for t in cur.description])
cur.execute(f"SELECT TOP 1 * FROM {t_name};")
desc = [(t[0], t[1]) for t in cur.description]
cur.fetchall()
print(desc)
cur.execute(f"SELECT * FROM {t_name} ORDER BY `{desc[0][0]}`;")
cols = [t[0] for t in cur.description]
with open(f'tables/{t_name}.csv', 'wb+') as f: