Skip to content

Commit 7cab8e7

Browse files
authored
pipelines init: make dev and prod different when specifying schema (#3303)
## Changes To cli-pipelines template, append .dev and .prod to distinguish between schemas in prod and dev, avoiding overwriting of data when initializing pipelines template with a custom schema in prompt or JSON. Furthermore, the prompt to the user for a schema explains that a specific schema will have .dev and .prod appended to it. In the README, the full name of the pipeline is now noted, along with where to find the pipeline. ## Tests SQL test, which uses the shared schema, updated to print an example template with the new schema.
1 parent 47ef49c commit 7cab8e7

File tree

9 files changed

+30
-5
lines changed

9 files changed

+30
-5
lines changed

acceptance/pipelines/e2e/output/my_project/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ For more tutorials and reference material, see https://docs.databricks.com/dlt.
4747
(Note that "dev" is the default target, so the `--target` parameter
4848
is optional here.)
4949
50+
This deploys everything that's defined for this project.
51+
For example, the default template would deploy a pipeline called
52+
`[dev yourname] my_project_pipeline` to your workspace.
53+
You can find that pipeline by opening your workpace and clicking on **Jobs & Pipelines**.
54+
5055
2. Similarly, to deploy a production copy, type:
5156
```
5257
$ pipelines deploy --target prod

acceptance/pipelines/init/error-cases/output/my_project/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ For more tutorials and reference material, see https://docs.databricks.com/dlt.
4747
(Note that "dev" is the default target, so the `--target` parameter
4848
is optional here.)
4949
50+
This deploys everything that's defined for this project.
51+
For example, the default template would deploy a pipeline called
52+
`[dev yourname] my_project_pipeline` to your workspace.
53+
You can find that pipeline by opening your workpace and clicking on **Jobs & Pipelines**.
54+
5055
2. Similarly, to deploy a production copy, type:
5156
```
5257
$ pipelines deploy --target prod

acceptance/pipelines/init/python/output/my_python_project/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ For more tutorials and reference material, see https://docs.databricks.com/dlt.
4747
(Note that "dev" is the default target, so the `--target` parameter
4848
is optional here.)
4949
50+
This deploys everything that's defined for this project.
51+
For example, the default template would deploy a pipeline called
52+
`[dev yourname] my_python_project_pipeline` to your workspace.
53+
You can find that pipeline by opening your workpace and clicking on **Jobs & Pipelines**.
54+
5055
2. Similarly, to deploy a production copy, type:
5156
```
5257
$ pipelines deploy --target prod

acceptance/pipelines/init/sql/input.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"project_name": "my_sql_project",
33
"default_catalog": "main",
44
"personal_schemas": "no",
5-
"shared_schema": "shared_dev",
5+
"shared_schema": "shared",
66
"language": "sql"
77
}

acceptance/pipelines/init/sql/output/my_sql_project/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ For more tutorials and reference material, see https://docs.databricks.com/dlt.
4646
(Note that "dev" is the default target, so the `--target` parameter
4747
is optional here.)
4848
49+
This deploys everything that's defined for this project.
50+
For example, the default template would deploy a pipeline called
51+
`[dev yourname] my_sql_project_pipeline` to your workspace.
52+
You can find that pipeline by opening your workpace and clicking on **Jobs & Pipelines**.
53+
4954
2. Similarly, to deploy a production copy, type:
5055
```
5156
$ pipelines deploy --target prod

acceptance/pipelines/init/sql/output/my_sql_project/databricks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@ targets:
4242
level: CAN_MANAGE
4343
variables:
4444
catalog: main
45-
schema: shared_dev
45+
schema: shared
4646
notifications: [[USERNAME]]

libs/template/templates/cli-pipelines/databricks_template_schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"default": "default",
4040
"pattern": "^\\w+$",
4141
"pattern_match_failure_message": "Invalid schema name.",
42-
"description": "\nInitial schema during development:\ndefault_schema",
42+
"description": "\nInitial schema during development:\nNote: This schema name will be suffixed with '_dev' when deployed to target the development environment.\ndefault_schema",
4343
"order": 5
4444
},
4545
"language": {

libs/template/templates/cli-pipelines/library/variables.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
{{- if (regexp "^yes").MatchString .personal_schemas -}}
1111
{{ short_name }}
1212
{{- else -}}
13-
{{ .shared_schema }}
13+
{{ .shared_schema }}_dev
1414
{{- end}}
1515
{{- end }}
1616

@@ -19,7 +19,7 @@
1919
{{- if (regexp "^yes").MatchString .personal_schemas -}}
2020
${workspace.current_user.short_name}
2121
{{- else -}}
22-
{{ .shared_schema }}
22+
{{ .shared_schema }}_dev
2323
{{- end}}
2424
{{- end }}
2525

libs/template/templates/cli-pipelines/template/{{.project_name}}/README.md.tmpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ For more tutorials and reference material, see https://docs.databricks.com/dlt.
5858
(Note that "dev" is the default target, so the `--target` parameter
5959
is optional here.)
6060

61+
This deploys everything that's defined for this project.
62+
For example, the default template would deploy a pipeline called
63+
`[dev yourname] {{.project_name}}_pipeline` to your workspace.
64+
You can find that pipeline by opening your workpace and clicking on **Jobs & Pipelines**.
65+
6166
2. Similarly, to deploy a production copy, type:
6267
```
6368
$ pipelines deploy --target prod

0 commit comments

Comments
 (0)