Models
Objects related to loading the dbt manifest.
Column
dataclass
Represents a column.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
The name of the column. |
description |
str
|
The description of the column. |
data_type |
str | None
|
The data type of the column. |
meta |
dict[str, Any]
|
The metadata attached to the column. |
constraints |
list[Constraint]
|
The list of constraints attached to the column. |
tags |
list[str]
|
The list of tags attached to the column. |
tests |
list[Test]
|
The list of tests attached to the column. |
_raw_values |
dict[str, Any]
|
The raw values of the column as defined in the node. |
_raw_test_values |
list[dict[str, Any]]
|
The raw test values of the column as defined in the node. |
Source code in src/dbt_score/models.py
from_node_values(values, test_values)
classmethod
Create a column object from raw values.
Source code in src/dbt_score/models.py
Constraint
dataclass
Constraint for a column.
Attributes:
Name | Type | Description |
---|---|---|
type |
str
|
The type of the constraint, e.g. |
name |
str | None
|
The name of the constraint. |
expression |
str | None
|
The expression of the constraint, e.g. |
_raw_values |
dict[str, Any]
|
The raw values of the constraint in the manifest. |
Source code in src/dbt_score/models.py
from_raw_values(raw_values)
classmethod
Create a constraint object from a constraint node in the manifest.
Source code in src/dbt_score/models.py
Duration
dataclass
Represents a duration used in SourceFreshness.
This is referred to as Time
in the dbt JSONSchema.
Attributes:
Name | Type | Description |
---|---|---|
count |
int | None
|
a positive integer |
period |
Literal['minute', 'hour', 'day'] | None
|
"minute" | "hour" | "day" |
Source code in src/dbt_score/models.py
HasColumnsMixin
Common methods for resource types that have columns.
Source code in src/dbt_score/models.py
ManifestLoader
Load the models, sources and tests from the manifest.
Source code in src/dbt_score/models.py
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 |
|
__init__(file_path, select=None)
Initialize the ManifestLoader.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path
|
Path
|
The file path of the JSON manifest. |
required |
select
|
Iterable[str] | None
|
An optional dbt selection. |
None
|
Source code in src/dbt_score/models.py
Model
dataclass
Bases: HasColumnsMixin
Represents a dbt model.
Attributes:
Name | Type | Description |
---|---|---|
unique_id |
str
|
The id of the model, e.g. |
name |
str
|
The name of the model. |
relation_name |
str
|
The relation name of the model, e.g. |
description |
str
|
The full description of the model. |
original_file_path |
str
|
The sql path of the model, |
config |
dict[str, Any]
|
The config of the model. |
meta |
dict[str, Any]
|
The meta of the model. |
columns |
list[Column]
|
The list of columns of the model. |
package_name |
str
|
The package name of the model. |
database |
str
|
The database name of the model. |
schema |
str
|
The schema name of the model. |
raw_code |
str
|
The raw code of the model. |
language |
str
|
The language of the model, e.g. sql. |
access |
str
|
The access level of the model, e.g. public. |
alias |
str | None
|
The alias of the model. |
patch_path |
str | None
|
The yml path of the model, e.g. |
tags |
list[str]
|
The list of tags attached to the model. |
tests |
list[Test]
|
The list of tests attached to the model. |
depends_on |
dict[str, list[str]]
|
Dictionary of models/sources/macros that the model depends on. |
_raw_values |
dict[str, Any]
|
The raw values of the model (node) in the manifest. |
_raw_test_values |
list[dict[str, Any]]
|
The raw test values of the model (node) in the manifest. |
Source code in src/dbt_score/models.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
|
__hash__()
from_node(node_values, test_values)
classmethod
Create a model object from a node and it's tests in the manifest.
Source code in src/dbt_score/models.py
Source
dataclass
Bases: HasColumnsMixin
Represents a dbt source table.
Attributes:
Name | Type | Description |
---|---|---|
unique_id |
str
|
The id of the source table, e.g. 'source.package.source_name.source_table_name'. |
name |
str
|
The alias of the source table. |
description |
str
|
The full description of the source table. |
source_name |
str
|
The source namespace. |
source_description |
str
|
The description for the source namespace. |
original_file_path |
str
|
The yml path to the source definition. |
config |
dict[str, Any]
|
The config of the source definition. |
meta |
dict[str, Any]
|
Any meta-attributes on the source table. |
source_meta |
dict[str, Any]
|
Any meta-attribuets on the source namespace. |
columns |
list[Column]
|
The list of columns for the source table. |
package_name |
str
|
The dbt package name for the source table. |
database |
str
|
The database name of the source table. |
schema |
str
|
The schema name of the source table. |
identifier |
str
|
The actual source table name, i.e. not an alias. |
loader |
str
|
The tool used to load the source table into the warehouse. |
freshness |
SourceFreshness
|
A set of time thresholds after which data may be considered stale. |
patch_path |
str | None
|
The yml path of the source definition. |
tags |
list[str]
|
The list of tags attached to the source table. |
tests |
list[Test]
|
The list of tests attached to the source table. |
_raw_values |
dict[str, Any]
|
The raw values of the source definition in the manifest. |
_raw_test_values |
list[dict[str, Any]]
|
The raw test values of the source definition in the manifest. |
Source code in src/dbt_score/models.py
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 |
|
selector_name: str
property
Returns the name used by the dbt source
method selector.
Note: This is also the format output by dbt ls --output name
for sources.
https://docs.getdbt.com/reference/node-selection/methods#the-source-method
__hash__()
from_node(node_values, test_values)
classmethod
Create a source object from a node and it's tests in the manifest.
Source code in src/dbt_score/models.py
SourceFreshness
dataclass
Represents a source freshness configuration.
This is referred to as FreshnessThreshold
in the dbt JSONSchema.
Attributes:
Name | Type | Description |
---|---|---|
warn_after |
Duration
|
The threshold after which the dbt source freshness check should soft-fail with a warning. |
error_after |
Duration
|
The threshold after which the dbt source freshness check should fail. |
filter |
str | None
|
An optional filter to apply to the input data before running source freshness check. |
Source code in src/dbt_score/models.py
Test
dataclass
Test for a column, model or source.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
The name of the test. |
type |
str
|
The type of the test, e.g. |
kwargs |
dict[str, Any]
|
The kwargs of the test. |
tags |
list[str]
|
The list of tags attached to the test. |
_raw_values |
dict[str, Any]
|
The raw values of the test in the manifest. |
Source code in src/dbt_score/models.py
from_node(test_node)
classmethod
Create a test object from a test node in the manifest.