Created
August 8, 2024 19:14
-
-
Save dkirkby/aee7fcc66552a81c40d6f73a4396da7b to your computer and use it in GitHub Desktop.
Dump column names for all tables to CSV
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fpoffline.db | |
DB = fpoffline.db.DB() | |
dbname = 'telemetry' | |
schema = DB.query(f"SELECT table_name, column_name FROM information_schema.columns WHERE table_schema = '{dbname}' order by table_name asc", maxrows=5000) | |
schema.to_csv(f'{dbname}-schema.csv', index=None) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment