Export sorted
This commit is contained in:
@ -38,8 +38,11 @@ if __name__ == '__main__':
|
|||||||
tbls = tbls.fetchall()
|
tbls = tbls.fetchall()
|
||||||
for file, _, t_name, t_type, _ in tbls:
|
for file, _, t_name, t_type, _ in tbls:
|
||||||
print(t_name)
|
print(t_name)
|
||||||
cur.execute(f"SELECT * FROM {t_name};")
|
cur.execute(f"SELECT TOP 1 * FROM {t_name};")
|
||||||
print([(t[0], t[1]) for t in cur.description])
|
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]
|
cols = [t[0] for t in cur.description]
|
||||||
|
|
||||||
with open(f'tables/{t_name}.csv', 'wb+') as f:
|
with open(f'tables/{t_name}.csv', 'wb+') as f:
|
||||||
|
Reference in New Issue
Block a user