-
Notifications
You must be signed in to change notification settings - Fork 109
Update the lakeflow-pipelines template according to the latest Lakeflow conventions #3558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
181627d
Add a Lakeflow-friendly default-python template, adapted to replace t…
lennartkats-db a7f1447
Fix .gitignore issue
lennartkats-db a7ff123
Process reviewer feedback
lennartkats-db ea97b0c
Merge remote-tracking branch 'origin/main' into lakeflow-default-pyth…
lennartkats-db d3acf61
Apply repo formatting
lennartkats-db 75bd17f
REmove spurious newline
lennartkats-db d708592
Formatting
lennartkats-db fbb1617
Minor fixes
lennartkats-db e588d1f
Use pyspark.pipelines
lennartkats-db bc9a90f
Include the right version of Python
lennartkats-db File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
10 changes: 7 additions & 3 deletions
10
acceptance/bundle/templates/lakeflow-pipelines/python/output.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
.../templates/lakeflow-pipelines/python/output/my_lakeflow_pipelines/.vscode/extensions.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,6 @@ | ||
| { | ||
| "recommendations": [ | ||
| "databricks.databricks", | ||
| "ms-python.vscode-pylance", | ||
| "redhat.vscode-yaml" | ||
| ] | ||
| } |
30 changes: 24 additions & 6 deletions
30
...le/templates/lakeflow-pipelines/python/output/my_lakeflow_pipelines/.vscode/settings.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,39 @@ | ||
| { | ||
| "python.analysis.stubPath": ".vscode", | ||
| "databricks.python.envFile": "${workspaceFolder}/.env", | ||
| "jupyter.interactiveWindow.cellMarker.codeRegex": "^# COMMAND ----------|^# Databricks notebook source|^(#\\s*%%|#\\s*\\<codecell\\>|#\\s*In\\[\\d*?\\]|#\\s*In\\[ \\])", | ||
| "jupyter.interactiveWindow.cellMarker.default": "# COMMAND ----------", | ||
| "python.testing.pytestArgs": [ | ||
| "." | ||
| ], | ||
| "python.testing.unittestEnabled": false, | ||
| "python.testing.pytestEnabled": true, | ||
| "python.analysis.extraPaths": ["resources/my_lakeflow_pipelines_pipeline"], | ||
| "files.exclude": { | ||
| "**/*.egg-info": true, | ||
| "**/__pycache__": true, | ||
| ".pytest_cache": true, | ||
| "dist": true, | ||
| }, | ||
| "files.associations": { | ||
| "**/.gitkeep": "markdown" | ||
| } | ||
|
|
||
| // Pylance settings (VS Code) | ||
| // Set typeCheckingMode to "basic" to enable type checking! | ||
| "python.analysis.typeCheckingMode": "off", | ||
| "python.analysis.extraPaths": ["src", "lib", "resources"], | ||
| "python.analysis.diagnosticMode": "workspace", | ||
| "python.analysis.stubPath": ".vscode", | ||
|
|
||
| // Pyright settings (Cursor) | ||
| // Set typeCheckingMode to "basic" to enable type checking! | ||
| "cursorpyright.analysis.typeCheckingMode": "off", | ||
| "cursorpyright.analysis.extraPaths": ["src", "lib", "resources"], | ||
| "cursorpyright.analysis.diagnosticMode": "workspace", | ||
| "cursorpyright.analysis.stubPath": ".vscode", | ||
|
|
||
| // General Python settings | ||
| "python.defaultInterpreterPath": "./.venv/bin/python", | ||
| "python.testing.unittestEnabled": false, | ||
| "python.testing.pytestEnabled": true, | ||
| "[python]": { | ||
| "editor.defaultFormatter": "ms-python.black-formatter", | ||
| "editor.defaultFormatter": "ms-python.python", | ||
fjakobs marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "editor.formatOnSave": true, | ||
| }, | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
7 changes: 7 additions & 0 deletions
7
...ndle/templates/lakeflow-pipelines/python/output/my_lakeflow_pipelines/lib/shared/taxis.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| from databricks.sdk.runtime import spark | ||
| from pyspark.sql import DataFrame | ||
|
|
||
|
|
||
| def find_all_taxis() -> DataFrame: | ||
| """Find all taxi data.""" | ||
| return spark.read.table("samples.nyctaxi.trips") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,5 +4,7 @@ dist/ | |
| __pycache__/ | ||
| *.egg-info | ||
| .venv/ | ||
| scratch/** | ||
| !scratch/README.md | ||
| **/explorations/** | ||
| **/!explorations/README.md | ||
1 change: 1 addition & 0 deletions
1
...undle/templates/lakeflow-pipelines/python/output/my_lakeflow_pipelines/resources/.gitkeep
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| This folder is reserved for Databricks Asset Bundles resource definitions. |
12 changes: 6 additions & 6 deletions
12
.../my_lakeflow_pipelines_pipeline/README.md → ...esources/lakeflow_pipelines_etl/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...y_lakeflow_pipelines/resources/lakeflow_pipelines_etl/lakeflow_pipelines_etl.pipeline.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # The main pipeline for my_lakeflow_pipelines | ||
|
|
||
| resources: | ||
| pipelines: | ||
| lakeflow_pipelines_etl: | ||
| name: lakeflow_pipelines_etl | ||
| ## Catalog is required for serverless compute | ||
| catalog: main | ||
lennartkats-db marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| schema: ${var.schema} | ||
| serverless: true | ||
| root_path: "." | ||
lennartkats-db marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| libraries: | ||
| - glob: | ||
| include: transformations/** | ||
14 changes: 8 additions & 6 deletions
14
...}_pipeline/{{.project_name}}.job.yml.tmpl → ...elines_etl/lakeflow_pipelines_job.job.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,21 @@ | ||
| # The job that triggers {{template `pipeline_name` .}}. | ||
| # The job that triggers lakeflow_pipelines_etl. | ||
|
|
||
| resources: | ||
| jobs: | ||
| {{template `job_name` .}}: | ||
| name: {{template `job_name` .}} | ||
| lakeflow_pipelines_job: | ||
| name: lakeflow_pipelines_job | ||
|
|
||
| trigger: | ||
| # Run this job every day, exactly one day from the last run; see https://docs.databricks.com/api/workspace/jobs/create#trigger | ||
| periodic: | ||
| interval: 1 | ||
| unit: DAYS | ||
|
|
||
| email_notifications: | ||
| on_failure: ${var.notifications} | ||
| #email_notifications: | ||
fjakobs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # on_failure: | ||
| # - [email protected] | ||
|
|
||
| tasks: | ||
| - task_key: refresh_pipeline | ||
| pipeline_task: | ||
| pipeline_id: ${resources.pipelines.{{template `pipeline_name` .}}.id} | ||
| pipeline_id: ${resources.pipelines.lakeflow_pipelines_etl.id} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...s/python/output/my_lakeflow_pipelines/resources/lakeflow_pipelines_etl/utilities/utils.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| from pyspark.sql.functions import col, when | ||
lennartkats-db marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| def distance_km(distance_col): | ||
| """Convert distance from miles to kilometers.""" | ||
| return distance_col * 1.60934 | ||
|
|
||
|
|
||
| def format_currency(amount_col): | ||
| """Format amount as currency.""" | ||
| return when(col(amount_col).isNotNull(), | ||
| col(amount_col).cast("decimal(10,2)")) | ||
19 changes: 0 additions & 19 deletions
19
...lakeflow_pipelines/resources/my_lakeflow_pipelines_pipeline/my_lakeflow_pipelines.job.yml
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
...low_pipelines/resources/my_lakeflow_pipelines_pipeline/my_lakeflow_pipelines.pipeline.yml
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
.../output/my_lakeflow_pipelines/resources/my_lakeflow_pipelines_pipeline/utilities/utils.py
This file was deleted.
Oops, something went wrong.
10 changes: 7 additions & 3 deletions
10
acceptance/bundle/templates/lakeflow-pipelines/sql/output.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
...dle/templates/lakeflow-pipelines/sql/output/my_lakeflow_pipelines/.vscode/extensions.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,6 @@ | ||
| { | ||
| "recommendations": [ | ||
| "databricks.databricks", | ||
| "ms-python.vscode-pylance", | ||
| "redhat.vscode-yaml" | ||
| ] | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.