Skip to content

Instantly share code, notes, and snippets.

@dkirkby
Created August 8, 2024 19:14
Show Gist options
  • Save dkirkby/aee7fcc66552a81c40d6f73a4396da7b to your computer and use it in GitHub Desktop.
Save dkirkby/aee7fcc66552a81c40d6f73a4396da7b to your computer and use it in GitHub Desktop.
Dump column names for all tables to CSV
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