TabularEditor / BestPracticeRules

An official collection of standard Rules for use with Tabular Editor's Best Practice Analyzer.
120 stars 53 forks source link

[Rule Request] META: No single column, single relation tables #24

Closed jsnape closed 4 years ago

jsnape commented 6 years ago

Here is a rule that I often find in models due to over normalization of tables. These generally crop up due to snowflaking in the underlying database schema. Note, I exclude hidden and key columns from the count.

{
    "ID": "NO_SINGLE_COLUMN_SINGLE_RELATION_TABLES",
    "Name": "No single column, single relation tables",
    "Category": "Performance",
    "Description": "Single column tables that only participate in a single relationship are unnecessary. Fold the attributes into the related table. Note, hidden and key columns are excluded.",
    "Severity": 1,
    "Scope": "Table",
    "Expression": "not IsHidden and Columns.Count(not Name.EndsWith(\"Key\")) = 1\nand Model.Relationships.Count(ToTable = outerIt) = 1",
    "FixExpression": null,
    "CompatibilityLevel": 1200
}

I'm not sure if this is META or PERF.

otykier commented 4 years ago

Great addition. Thanks!