Skip to content
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

Add source attribute to dbt_task and sql_task.file tasks to support files from workspace #3208

Merged
merged 6 commits into from
Feb 14, 2024

Conversation

alexott
Copy link
Contributor

@alexott alexott commented Feb 2, 2024

Changes

Also added support for it in TF exporter

Tests

  • make test run locally
  • relevant change in docs/ folder
  • covered with integration tests in internal/acceptance
  • relevant acceptance tests are passing
  • using Go SDK

…port files from workspace

Also added support for it in TF exporter
@alexott alexott requested review from a team as code owners February 2, 2024 14:03
@alexott alexott requested review from mgyucht and gaborratky-db and removed request for a team February 2, 2024 14:03
Copy link
Contributor

@gaborratky-db gaborratky-db left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added suggestions for docs and a few questions/requests to clarify what and why the code does what it does.

Is there test coverage for Import the PR could extend? Logic like len(parts) >= 4 feel brittle and the assumptions could break about how a path looks like in the future.

docs/resources/job.md Outdated Show resolved Hide resolved
docs/resources/job.md Outdated Show resolved Hide resolved
docs/resources/job.md Outdated Show resolved Hide resolved
docs/resources/job.md Outdated Show resolved Hide resolved
exporter/util.go Show resolved Hide resolved
exporter/importables.go Show resolved Hide resolved
alexott and others added 4 commits February 5, 2024 10:43
Co-authored-by: Gabor Ratky <gabor.ratky@databricks.com>
Co-authored-by: Gabor Ratky <gabor.ratky@databricks.com>
Co-authored-by: Gabor Ratky <gabor.ratky@databricks.com>
Co-authored-by: Gabor Ratky <gabor.ratky@databricks.com>
@codecov-commenter
Copy link

codecov-commenter commented Feb 5, 2024

Codecov Report

Attention: 17 lines in your changes are missing coverage. Please review.

Comparison is base (d3acc7b) 83.57% compared to head (e07bb2a) 83.75%.
Report is 27 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3208      +/-   ##
==========================================
+ Coverage   83.57%   83.75%   +0.17%     
==========================================
  Files         168      170       +2     
  Lines       15021    15334     +313     
==========================================
+ Hits        12554    12843     +289     
- Misses       1729     1738       +9     
- Partials      738      753      +15     
Files Coverage Δ
jobs/resource_job.go 89.42% <ø> (+0.90%) ⬆️
exporter/util.go 79.56% <77.77%> (-0.38%) ⬇️
exporter/importables.go 77.92% <0.00%> (-0.79%) ⬇️

... and 19 files with indirect coverage changes

@alexott alexott requested a review from tanmay-db February 8, 2024 12:51
Copy link
Contributor

@tanmay-db tanmay-db left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, have some questions, logic overall looks good.

@@ -240,6 +247,7 @@ func (ic *importContext) emitNotebookOrRepo(path string) {
if strings.HasPrefix(path, "/Repos") {
ic.emitRepoByPath(path)
} else {
// TODO: strip /Workspace prefix if it's provided
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Is this TODO not required currently? what happens if /Workspace prefix is provided?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's related to this issue: #3195 - we're introduced ability to refer to objects with /Workspace and without, but notebooks/workspace files right now are using path without /Workspace, so I just left a comment for myself to handle this case in the near future

Value: strings.Join(parts[:4], "/"),
})
} else {
log.Printf("[WARN] Incorrect Repos path")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of warn, shouldn't we Fail here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, our APIs aren't strictly consistent, so it's possible to create jobs pointing to non-existing paths, clusters, etc., but we should tolerate that :-( Otherwise, a lot of exports will fail - it's easier to fix TF code sometimes than fix objects in the workspace

exporter/util.go Show resolved Hide resolved
@alexott alexott added this pull request to the merge queue Feb 14, 2024
Merged via the queue into main with commit 37382fb Feb 14, 2024
5 checks passed
@alexott alexott deleted the jobs-source-dbt-sql-file-tasks branch February 14, 2024 15:02
@hectorcast-db hectorcast-db mentioned this pull request Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants