Package for Fabric Engineers
Project description
FabricEngineer Package
Description
...
Quickstart
Run Silver Ingestion
SilverIngesationInsertOnly
from pyspark.sql import DataFrame, functions as F
from fabricengineer.transform import (
BaseSilverIngestion,
SilverIngesationInsertOnly,
BronzeTransformation
)
from fabricengineer.logging import TimeLogger
def transform_projects(
df: DataFrame,
etl: BaseSilverIngestion
) -> DataFrame:
df = df.withColumn("dtime", F.to_timestamp("dtime"))
return df
timer = TimeLogger()
transformations = [
BronzeTransformation(table="projects", fn=transform_projects)
]
etl = SilverIngestionInsertOnly(
spark=spark,
df_bronze=None,
src_lakehouse=SOURCE_LAKEHOUSE,
src_schema=SOURCE_SCHEMA,
src_tablename=SOURCE_TABLENAME,
dist_lakehouse=DESTINATION_LAKEHOUSE,
dist_schema=DESTINATION_SCHEMA,
dist_tablename=DESTINATION_TABLENAME,
nk_columns=NK_COLUMNS,
constant_columns=CONSTANT_COLUMNS,
is_delta_load=IS_DELTA_LOAD,
delta_load_use_broadcast=DELTA_LOAD_USE_BROADCAST,
transformations=TRANSFORMATIONS,
exclude_comparing_columns=EXCLUDE_COLUMNS_FROM_COMPARING,
include_comparing_columns=INCLUDE_COLUMNS_AT_COMPARING,
historize=HISTORIZE,
partition_by_columns=PARTITION_BY_COLUMNS,
create_history_mlv=CREATE_HISTORY_MLV
)
timer.start().log()
etl.run()
timer.end().log()
SilverIngesationSCD2
from pyspark.sql import DataFrame, functions as F
from fabricengineer.transform import (
BaseSilverIngestion,
SilverIngesationSCD2,
BronzeTransformation
)
from fabricengineer.logging import TimeLogger
def transform_projects(
df: DataFrame,
etl: BaseSilverIngestion
) -> DataFrame:
df = df.withColumn("dtime", F.to_timestamp("dtime"))
return df
timer = TimeLogger()
transformations = [
BronzeTransformation(table="projects", fn=transform_projects)
]
etl = SilverIngesationSCD2(
spark=spark,
df_bronze=None,
src_lakehouse=SOURCE_LAKEHOUSE,
src_schema=SOURCE_SCHEMA,
src_tablename=SOURCE_TABLENAME,
dist_lakehouse=DESTINATION_LAKEHOUSE,
dist_schema=DESTINATION_SCHEMA,
dist_tablename=DESTINATION_TABLENAME,
nk_columns=NK_COLUMNS,
constant_columns=CONSTANT_COLUMNS,
is_delta_load=IS_DELTA_LOAD,
delta_load_use_broadcast=DELTA_LOAD_USE_BROADCAST,
transformations=TRANSFORMATIONS,
exclude_comparing_columns=EXCLUDE_COLUMNS_FROM_COMPARING,
include_comparing_columns=INCLUDE_COLUMNS_AT_COMPARING,
historize=HISTORIZE,
partition_by_columns=PARTITION_BY_COLUMNS
)
timer.start().print()
etl.run()
timer.end().print()
Eigenes Package: fabric-utils-py (SilverIngestionInsertOnly, MaterializedLakeView(lakehouse, schema, table_name, mode=CREATE | DROP_CREATE).execute(); ...
Manage MaterializeLakeViews
Create once
from fabricengineer.mlv import MaterializeLakeView
sql = """
SELECT
p.id
,p.projectname
,p.budget
,u.name AS projectlead
FROM dbo.projects p
LEFT JOIN users u
ON p.projectlead_id = u.id
"""
mlv = MaterializeLakeView(sql, spark=spark)
mlv.create(mode=MLVMode.CREATE) # Creates the MLV once
Recreate MLV
mlv = MaterializeLakeView(sql, spark=spark)
mlv.recreate(mode=MLVMode.CREATE) # Drops and Creates the MLV
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fabricengineer_py-0.0.8.tar.gz.
File metadata
- Download URL: fabricengineer_py-0.0.8.tar.gz
- Upload date:
- Size: 45.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9bce818652ee8bbd9298b5578ea4a3ce3bcd3d4668e0fc09d665e147fc8b8cd5
|
|
| MD5 |
065ad735486acc724572936bf8347b26
|
|
| BLAKE2b-256 |
65aa70fd24bb88ddeb3de344c54ef010c9887f960499b4911a1bb1b2ee9f5e6b
|
Provenance
The following attestation bundles were made for fabricengineer_py-0.0.8.tar.gz:
Publisher:
release.yml on enricogoerlitz/fabricengineer-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fabricengineer_py-0.0.8.tar.gz -
Subject digest:
9bce818652ee8bbd9298b5578ea4a3ce3bcd3d4668e0fc09d665e147fc8b8cd5 - Sigstore transparency entry: 348922636
- Sigstore integration time:
-
Permalink:
enricogoerlitz/fabricengineer-py@340ae482c0039ce5946b86b9444ecf282f72b351 -
Branch / Tag:
refs/tags/0.0.8 - Owner: https://github.com/enricogoerlitz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@340ae482c0039ce5946b86b9444ecf282f72b351 -
Trigger Event:
push
-
Statement type:
File details
Details for the file fabricengineer_py-0.0.8-py3-none-any.whl.
File metadata
- Download URL: fabricengineer_py-0.0.8-py3-none-any.whl
- Upload date:
- Size: 14.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70fb32c433e6b0b8b59ec42355980a869b7ed987ef050625e79aca5872308a9c
|
|
| MD5 |
7492e73286bfed96c4cd37f1f9a8f330
|
|
| BLAKE2b-256 |
f3807f116cc6fa60ac312c4fc738870ee75011888e327955dabff1bfa8a7cfb6
|
Provenance
The following attestation bundles were made for fabricengineer_py-0.0.8-py3-none-any.whl:
Publisher:
release.yml on enricogoerlitz/fabricengineer-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fabricengineer_py-0.0.8-py3-none-any.whl -
Subject digest:
70fb32c433e6b0b8b59ec42355980a869b7ed987ef050625e79aca5872308a9c - Sigstore transparency entry: 348922660
- Sigstore integration time:
-
Permalink:
enricogoerlitz/fabricengineer-py@340ae482c0039ce5946b86b9444ecf282f72b351 -
Branch / Tag:
refs/tags/0.0.8 - Owner: https://github.com/enricogoerlitz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@340ae482c0039ce5946b86b9444ecf282f72b351 -
Trigger Event:
push
-
Statement type: