Regenerating Modeled Tables from the Command Line
The rules regenerate command runs the same Save the Rules Editor performs over every modeled table of a file mode project, from the command line and with no web host. It is a verb of the BimlFlex server executable, so nothing else installs with it. Run it beside the project build described in Building Using the Command Line in your automated processes, for example as a build time freshness check with --check.
Usage
BimlFlex rules regenerate --project <folder> [--dialect <code>] [--report <file>] [--check]
The cross platform build runs it as dotnet BimlFlex.dll rules regenerate from the build's output folder.
--help prints the usage. No argument, an unknown option, a missing value or a repeated option prints the defect and the usage on standard error.
Options
--project <folder>is the root folder of the file mode project, the folder that holdsbimlflex.json. This option is required.--dialect <code>is the system type code to render for, for exampleMSSQLorSFLDW. Without it, each table renders for the system type of its own connection.--report <file>writes the JSON report to this file. Without it, the report goes to standard output.--checkrenders and compares without writing. A table whose Source Create SQL or last generated SQL differs from the fresh render is stale, which makes the command a build time freshness check.
What a run does
- The license check runs before any project file is read. It is the same check that generating, applying and previewing the SQL of a modeled table carry. A refusal prints its code and message on standard error.
- The file mode project opens from the folder.
- Every modeled table is read with its rules, in schema, name and connection order. A forked table is reported as forked and nothing of it is written. Every other table is saved as the Rules Editor saves a table, so the rows, the generated SQL, the fork rule and the parse at save are the same. A render equal to the view SQL writes no view SQL. A table the save refuses is reported with its validation rows, and the run continues.
- The report is written, and the closing line on standard error names the exit code.
Exit codes
| Code | Meaning |
|---|---|
| 0 | Every modeled table is written, unchanged or forked. With --check, every table is fresh or forked. |
| 1 | With --check, a table is stale. Otherwise a table is refused, and every other table is regenerated. |
| 2 | The arguments do not parse. Nothing is read. |
| 3 | The license does not entitle the rules layer. No project file is read. |
| 4 | The folder is not a file mode project, or the project does not open. Nothing is written. |
| 5 | The run stops on an unexpected failure, or the report file cannot be written. |
The report
The report is one JSON document, indented with line feeds, keyed by names and never by identifiers, so the same project answers the same bytes on every machine:
{
"mode": "regenerate",
"dialect": null,
"ranAt": "2030-01-02T03:04:05Z",
"tables": [
{
"connection": "Warehouse",
"schema": "rdv",
"name": "Customer_Miss",
"state": "written",
"misses": [ { "rule": "Shout", "message": "cus carries no column MiddleName." } ],
"diagnostics": [],
"errors": []
}
],
"totals": { "tables": 1, "written": 1, "unchanged": 0, "forked": 0, "stale": 0, "refused": 0 },
"exitCode": 0
}
modeisregenerateorcheck, anddialectis the--dialectvalue or null.tablescarries one entry for each modeled table, named by itsconnection,schemaandname, with itsstate.stateis one of these values:written: the view SQL is rewritten.unchanged: the fresh render equals the view SQL, and nothing of the view is written.forked: the table is forked, or this save forks it because its view SQL is hand edited.stale: with--checkonly, the table differs from the fresh render.refused: the rules do not render, or the save is refused.
missesare the misses of the rule parse, each with itsruleandmessage. Theruleis null for a join, filter or trailing step miss.diagnosticsare the codes of the render and the save, in order of first appearance.errorsare the validation rows of a refused save.totalscounts the tables and the tables in each state.exitCodeis the exit code of the run.ranAtis the UTC time of the run.
Scope
The command serves file mode projects alone. A database store is outside its reach.