Skip to main content

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 holds bimlflex.json. This option is required.
  • --dialect <code> is the system type code to render for, for example MSSQL or SFLDW. 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.
  • --check renders 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​

  1. 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.
  2. The file mode project opens from the folder.
  3. 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.
  4. The report is written, and the closing line on standard error names the exit code.

Exit codes​

CodeMeaning
0Every modeled table is written, unchanged or forked. With --check, every table is fresh or forked.
1With --check, a table is stale. Otherwise a table is refused, and every other table is regenerated.
2The arguments do not parse. Nothing is read.
3The license does not entitle the rules layer. No project file is read.
4The folder is not a file mode project, or the project does not open. Nothing is written.
5The 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
}
  • mode is regenerate or check, and dialect is the --dialect value or null.
  • tables carries one entry for each modeled table, named by its connection, schema and name, with its state.
  • state is 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 --check only, the table differs from the fresh render.
    • refused: the rules do not render, or the save is refused.
  • misses are the misses of the rule parse, each with its rule and message. The rule is null for a join, filter or trailing step miss.
  • diagnostics are the codes of the render and the save, in order of first appearance.
  • errors are the validation rows of a refused save.
  • totals counts the tables and the tables in each state.
  • exitCode is the exit code of the run.
  • ranAt is the UTC time of the run.

Scope​

The command serves file mode projects alone. A database store is outside its reach.