LilBudyWizer
Warlord
- Joined
- Nov 11, 2014
- Messages
- 174
I extracted the database definitions and put them in JSON files. Since I was pulling data out of the databases I decided I might as well put the data in a database. I pull the definitions using pragmas, but you can't use a pragma as a table or view. So I loaded the data from the pragmas back into tables you can query. The general structure is:
The tables are generally keyed as SchID, TblID, ColID. I provide a Hier view for each table to pick up the names. With Schemas and Tables I provide a WithStats view that combines the information from the two tables. I also provide additional tables:
Tags are the name of the table/column split into words. There's nothing you couldn't get from the base tables: Schemas, Tables, Columns, Indexes, IndexColumns and ForeignKeys. The rest is to simplify accessing the data. Queries can get complex and basics covered can make those queries far less tedious. Everything is also in JSON files. You could pull the data off the database and stick in some structure or just load the JSON.
Code:
Schemas
SchemaStats
Tables
TableStats
TableTags
Columns
ColumnTags
Indexes
IndexColumns
ForeignKeys
- Children
- Orphans
- Parents
- Childless
- ChildlessOrphans
Tags are the name of the table/column split into words. There's nothing you couldn't get from the base tables: Schemas, Tables, Columns, Indexes, IndexColumns and ForeignKeys. The rest is to simplify accessing the data. Queries can get complex and basics covered can make those queries far less tedious. Everything is also in JSON files. You could pull the data off the database and stick in some structure or just load the JSON.