Skip to main content

easyfabric.data.model

json

logging

operator

re

dataclass

field

fields

Callable

Optional

ConfigManager

DataClassFromDictMixin

check_format

read_file_as_string

yaml_to_json

to_snake_case

def to_snake_case(string: str) -> str

Reference Objects

@dataclass
class Reference(DataClassFromDictMixin)

Table relationship reference in an analytical model.

Points to another table that this table has a relationship with (e.g. a dimension referenced by a fact table).

table

Loadsetting Objects

@dataclass
class Loadsetting(DataClassFromDictMixin)

notebook

loadactive

loadorder

Measures Objects

@dataclass
class Measures(DataClassFromDictMixin)

DAX measure definition for an analytical model.

Holds the measure name, DAX expression, format string, and display folder for use in tabular model deployment.

name

expression

description

formatstring

displayfolder

ishidden

Column Objects

@dataclass
class Column(DataClassFromDictMixin)

Model column with source mapping and data type.

Represents a column in a model table, mapping the source column name to its analytical data type.

sourcecolumn

type

Partition Objects

@dataclass
class Partition(DataClassFromDictMixin)

Table partition definition for an analytical model.

Specifies the partition source query and processing load order for partitioned table refreshes.

partitionsource

processloadorder

Table Objects

@dataclass
class Table(DataClassFromDictMixin)

Model table definition (fact or dimension).

Represents a table in an analytical model with its columns, measures, partitions, relationships, and load settings.

tabletype

name

sourceschema

sourcetable

references

columns

partitions

processloadorder

loadsettings

measures

surrogatekeyunknownvalue

keydatatype

get_table_abfs

def get_table_abfs(config_manager: ConfigManager)

get_table_fullname

def get_table_fullname(config_manager: ConfigManager)

get_sk_unknownvalue

def get_sk_unknownvalue(config_manager: ConfigManager)

Model Objects

@dataclass
class Model(DataClassFromDictMixin)

Analytical model definition with tables, columns, measures, and relationships.

Loaded from a YAML model file, this is the top-level container for a tabular model's structure used during gold-layer deployment.

tables

__post_init__

def __post_init__()

get_table

def get_table(object_name: str) -> Optional[Table]

Find a table by its name or source table name.

Arguments:

  • object_name - The table name or source table name to search for (case-insensitive).

Returns:

The matching Table, or None if not found.

get_tables_lambda_filter

def get_tables_lambda_filter(
filter_func: Callable[[Table], bool]) -> list[Table]

Generic filter using a callable (e.g., for complex logic).

get_tables_by_field_filter

def get_tables_by_field_filter(field: str,
value: str,
op: str = "==") -> list[Table]

Filters tables by a specific field and value using operator.

Arguments:

  • field str - Attribute name, e.g., 'tabletype'.
  • value str - Target value, e.g., 'dim'.
  • op str - Operator like '==', '!=', '>' (default '==').

Returns:

  • List[Table] - Filtered tables.

dataclass

Optional

get_distinct_load_tuples

@staticmethod
def get_distinct_load_tuples(
tables: list[Table]
) -> list[tuple[str, str, Optional[str], Optional[int]]]

Updated for lowercase fields: (name, tabletype, notebook, load_order)

get_unique_load_combos

@staticmethod
def get_unique_load_combos(tables: list[Table]) -> list[dict[str, any]]

Extracts unique combinations of name, tabletype, loadsettings.notebook, and loadsettings.loadorder from a list of Tables. Flattens multiple Loadsettings per table.

Arguments:

  • tables List[Table] - Input tables (e.g., dim_tables).

Returns:

List[Dict[str, any]]: List of unique dicts, e.g.,

  • [{'name' - 'customer_dim', 'tabletype': 'dim', 'notebook': 'load_bronze', 'loadorder': 1}, ...] Sorted by name, then loadorder for predictable looping.

Notes:

  • Skips tables with no loadsettings.
  • Duplicates (same combo across tables) are removed.
  • If notebook or loadorder is None, it's included as-is.

from_yaml_file

@classmethod
def from_yaml_file(cls, file_path: str)

Create a Model instance from a YAML file.