Model Wizard
The Model Wizard is KIDEx's database reverse-engineering tool. It connects to a live database, queries the catalog, and generates Kittox Model YAML files automatically — saving hours of manual work on projects with dozens of tables.
It is also the recommended way to keep your models in sync with the database when the schema changes: re-running the wizard on an existing project detects new columns, removed columns, and changed data types, and proposes a list of update actions you can review before applying.
When to use the Model Wizard
- New project, existing database — you have a database (yours or imported from another system) and you need a Model file for each table you intend to use in Kittox. The wizard generates the whole Models folder in seconds.
- Schema migration — your DBA has added columns to a table; re-run the wizard to update the affected Models without losing the customizations you've already made (display labels, widths, rules, allowed values).
- Quick prototyping — point the wizard at a sample database to bootstrap a working Kittox application in minutes.
Launching the wizard
There are three ways to start the wizard:
- Menu: Tools > Model Wizard
- Right-click the Models node in the project tree → Import from Database
- Toolbar: the database-import icon (when a project is open)
The project must be open and at least one database connection must be configured in Config.yaml (see Database Configuration and the Config Editor).
Wizard steps
1. Choose the database connection
The wizard lists all the connections defined under Databases in your Config.yaml. Pick the one whose schema you want to import.
If the connection requires credentials, the wizard prompts for them (and remembers them for the rest of the session, never persisting them to disk).
2. Browse and select tables
KIDEx queries the database catalog and shows the available objects:
| Option | Effect |
|---|---|
| Include views as tables | Adds database views to the list — generated as read-only Models, useful for reporting screens |
| Filter by name | Substring filter to narrow down a long table list |
| Select all / Select none | Bulk selection helpers |
Tick the tables you want to import. The wizard remembers the selection across sessions for the same project.
3. Choose options
| Option | Default | Description |
|---|---|---|
| Beautify names | On | Converts UPPER_UNDERSCORE and Names With Spaces (e.g. Quarterly Orders, Sales by Category — common in Northwind-style sample DBs) into CamelCase for the Kittox Model and Field names (QuarterlyOrders, SalesByCategory), while preserving the original PhysicalName for the SQL layer. Disable this if your DB already uses readable names. |
| Generate detail references | On | Detects foreign keys pointing into each table and adds DetailReferences for the inverse relationship (one-to-many master→detail). Disable for very dense schemas where you'd get spurious detail tabs. |
| Generate references | On | Detects foreign keys leaving each table and produces Reference() fields with IsLarge set when the referenced table has many rows. |
| Update existing models | On | When a Model file already exists, the wizard switches to diff mode (see below). When off, existing files are left untouched. |
| Preserve custom properties | On | In diff mode, never overwrite hand-edited properties like DisplayLabel, DisplayWidth, Hint, IsRequired, AllowedValues, Rules, DefaultValue. |
4. Review the proposed actions
Before writing anything to disk, the wizard shows a review panel with one row per action:
| Action type | Meaning |
|---|---|
| Add Model | A .yaml file will be created for a new table |
| Update Model | An existing .yaml file will be modified |
| Delete Model | An existing .yaml file references a table that no longer exists in the DB |
| Add Field | A new column has been detected on an existing table |
| Update Field | A column has changed (data type, size, NULL/NOT NULL) |
| Delete Field | A column is no longer in the DB |
| Set Primary Key | The PK definition has changed |
| Add/Update/Delete Reference | A foreign key has been added, modified, or removed |
| Add/Update/Delete Detail Reference | The inverse FK relationship has changed |
Each action has a checkbox: untick the ones you don't want to apply. The detail panel on the right shows the YAML diff so you can see exactly what will change.
5. Apply
Click Apply to execute the selected actions. KIDEx:
- Saves all currently open editors (a backup safety net before changing files)
- Writes the new and updated
.yamlfiles - Removes deleted files (if any)
- Refreshes the project tree
- Logs every action in the bottom panel with file paths
The metadata catalog is reloaded automatically — you can immediately edit the generated Models in the Model Editor or open them in YAML mode.
What the wizard generates
A typical Model generated for an EMPLOYEE table looks like this:
ModelName: Employee
PhysicalName: EMPLOYEE
Fields:
Id: Integer primary key
DisplayLabel: ID
PhysicalName: EMP_ID
FirstName: String(50) not null
DisplayLabel: First Name
PhysicalName: FIRST_NAME
LastName: String(50) not null
DisplayLabel: Last Name
PhysicalName: LAST_NAME
HireDate: Date
DisplayLabel: Hire Date
PhysicalName: HIRE_DATE
Department: Reference(Department) not null
DisplayLabel: Department
Fields:
DEPT_ID:
PhysicalName: DEPT_ID
DetailReferences:
Activities:
Model: Activity
ReferenceField: EmployeeWhat you get for free:
PhysicalNamestamped on every Field that was renamed by the beautifier — keeps the SQL layer pointing at the original column name.- Primary keys detected from the catalog and marked with
primary key. - Not-null constraints translated into
not nullmodifiers. - Foreign keys rendered as
Reference(TargetModel)fields with the appropriate FK column underFields:. - Inverse foreign keys (other tables pointing at this one) rendered as
DetailReferencesso master/detail forms work out of the box. - Auto-generated
DisplayLabelvalues produced by the beautifier (EMPLOYEE_ID→Employee Id→ adjusted toEmployee ID).
Diff mode (re-running on an existing project)
When you re-run the wizard on a project where Models already exist, the wizard switches to diff mode:
- Each table in the DB is compared field-by-field against the existing Model file
- New columns produce Add Field actions
- Changed columns produce Update Field actions (with a side-by-side diff)
- Removed columns produce Delete Field actions, opt-in by default — unticked, so accidentally renaming a column in the DB doesn't cause a destructive Model edit
- Tables that are no longer in the DB produce Delete Model actions, also opt-in
Hand-edited properties (DisplayLabel, DisplayWidth, IsRequired, Rules, AllowedValues, etc.) are always preserved when Preserve custom properties is on (default).
Tips
- Filter the table list with a substring before importing — most DBs have system tables and audit tables you don't need in Kittox.
- Untick uninteresting tables the first time round. You can always re-run the wizard later to add more.
- Inspect the YAML diff in the review panel before applying — the wizard never modifies anything until you click Apply.
- Use a dev database for the first import. Once you're happy with the result, you can re-run the wizard against staging or production to update.
- Validate after import with Tools > Validate All to surface any reference issues introduced by the new Models.
See also
- Models — the Model YAML reference
- Model Editor — manual editing of the generated Models
- Config Editor — Databases — configuring the connections the wizard reads from
- How to access the database — when you need to run SQL outside the Model framework
