add_hash_columns
Public callable
Add business key and row-level SHA256 hash columns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
Any
|
Input pandas or Spark DataFrame. |
required |
business_keys
|
list[str] | None
|
Business key columns used to build |
None
|
row_hash_columns
|
list[str] | None
|
Columns used to build |
None
|
include_business_key_hash
|
bool
|
Whether to add |
True
|
include_row_hash
|
bool
|
Whether to add |
True
|
engine
|
str
|
Execution engine ( |
"auto"
|
Returns:
| Type | Description |
|---|---|
Any
|
DataFrame with hash columns added. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If business key hashing is enabled without |
Examples:
>>> import pandas as pd
>>> df = pd.DataFrame({"BUSINESS_KEY": ["A1"], "amount": [10.5]})
>>> out = add_hash_columns(df, business_keys=["BUSINESS_KEY"], engine="pandas")
>>> "_row_hash" in out.columns
True
Source code in src/fabricops_kit/technical_columns.py
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 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 | |