-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Issue 275: Support dbt package dependencies in Git subdirectories #3267
Merged
jtcohen6
merged 15 commits into
dbt-labs:develop
from
dmateusp:dmateusp/275/support_github_subdirs
Apr 28, 2021
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
4cf9674
🔨 Extend git package contract and signatures to pass `subdirectory`
032d2b2
Add sparse checkout logic
82527fe
✅ Add test
db1f5e9
🧹 Lint
b808648
✏️ Update CHANGELOG
1987374
🐛 Make os.path.join safe
1767b53
Use a test-container with an updated `git` version
7be1a48
🔨 Fix integration tests
db40aaf
📖 Update CHANGELOG contributors to include this PR
f50c5f1
🧪 Parameterize the test
87250bb
Use new test-container published by @kwigley (contains more recent ve…
a183888
Use repositories managed by fishtown
e1234e0
🧘♂️ Merge the CHANGELOG
405d524
🤦♂️ Remove repetition of my contribution on the CHANGELOG
26c3b95
Merge branch 'develop' into dmateusp/275/support_github_subdirs
jtcohen6 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
This file contains 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 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 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 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 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 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 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 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 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 |
---|---|---|
|
@@ -72,42 +72,78 @@ def deps_with_packages(packages, bad_packages, project_dir, profiles_dir, schema | |
querier.is_result(querier.async_wait(tok1)) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jtcohen6 I parametrized the test instead of the copy paste fyi (I did this when I merged the changes from the PR that adds support for commits here) |
||
"packages, bad_packages", | ||
# from dbt hub | ||
[( | ||
[{ | ||
'package': 'fishtown-analytics/dbt_utils', | ||
'version': '0.5.0', | ||
}], | ||
# wrong package name | ||
[{ | ||
'package': 'fishtown-analytics/dbt_util', | ||
'version': '0.5.0', | ||
}], | ||
), | ||
# from git release/tag/branch | ||
( | ||
[{ | ||
'git': 'https:/fishtown-analytics/dbt-utils.git', | ||
'revision': '0.5.0', | ||
}], | ||
# if you use a bad URL, git thinks it's a private repo and prompts for auth | ||
[{ | ||
'git': 'https:/fishtown-analytics/dbt-utils.git', | ||
'revision': 'not-a-real-revision', | ||
}], | ||
), | ||
# from git commit | ||
( | ||
[{ | ||
'git': 'https:/fishtown-analytics/dbt-utils.git', | ||
'revision': 'b736cf6acdbf80d2de69b511a51c8d7fe214ee79', | ||
}], | ||
# don't use short commits | ||
[{ | ||
'git': 'https:/fishtown-analytics/dbt-utils.git', | ||
'revision': 'b736cf6', | ||
}], | ||
), | ||
# from git release and subdirectory | ||
( | ||
[{ | ||
'git': 'https:/fishtown-analytics/dbt-labs-experimental-features.git', | ||
'revision': '0.0.1', | ||
'subdirectory': 'materialized-views', | ||
}], | ||
[{ | ||
'git': 'https:/fishtown-analytics/dbt-labs-experimental-features.git', | ||
'revision': '0.0.1', | ||
'subdirectory': 'path/to/nonexistent/dir', | ||
}], | ||
), | ||
# from git commit and subdirectory | ||
( | ||
[{ | ||
'git': 'https:/fishtown-analytics/dbt-utils.git', | ||
'revision': 'f4f84e9110db26aba22f756abbae9f1f8dbb15da', | ||
'subdirectory': 'dbt_projects/dbt_utils', | ||
}], | ||
[{ | ||
'git': 'https:/fishtown-analytics/dbt-utils.git', | ||
'revision': 'f4f84e9110db26aba22f756abbae9f1f8dbb15da', | ||
'subdirectory': 'path/to/nonexistent/dir', | ||
}], | ||
)], | ||
ids=[ | ||
"from dbt hub", | ||
"from git release/tag/branch", | ||
"from git commit", | ||
"from git release and subdirectory", | ||
"from git commit and subdirectory", | ||
], | ||
) | ||
@pytest.mark.supported('postgres') | ||
def test_rpc_deps_packages(project_root, profiles_root, dbt_profile, unique_schema): | ||
packages = [{ | ||
'package': 'fishtown-analytics/dbt_utils', | ||
'version': '0.5.0', | ||
}] | ||
bad_packages = [{ | ||
'package': 'fishtown-analytics/dbt_util', | ||
'version': '0.5.0', | ||
}] | ||
deps_with_packages(packages, bad_packages, project_root, profiles_root, unique_schema) | ||
|
||
|
||
@pytest.mark.supported('postgres') | ||
def test_rpc_deps_git(project_root, profiles_root, dbt_profile, unique_schema): | ||
packages = [{ | ||
'git': 'https:/fishtown-analytics/dbt-utils.git', | ||
'revision': '0.5.0' | ||
}] | ||
# if you use a bad URL, git thinks it's a private repo and prompts for auth | ||
bad_packages = [{ | ||
'git': 'https:/fishtown-analytics/dbt-utils.git', | ||
'revision': 'not-a-real-revision' | ||
}] | ||
deps_with_packages(packages, bad_packages, project_root, profiles_root, unique_schema) | ||
|
||
|
||
@pytest.mark.supported('postgres') | ||
def test_rpc_deps_git_commit(project_root, profiles_root, dbt_profile, unique_schema): | ||
packages = [{ | ||
'git': 'https:/fishtown-analytics/dbt-utils.git', | ||
'revision': 'b736cf6acdbf80d2de69b511a51c8d7fe214ee79' | ||
}] | ||
# don't use short commits | ||
bad_packages = [{ | ||
'git': 'https:/fishtown-analytics/dbt-utils.git', | ||
'revision': 'b736cf6' | ||
}] | ||
def test_rpc_deps_packages(project_root, profiles_root, dbt_profile, unique_schema, packages, bad_packages): | ||
deps_with_packages(packages, bad_packages, project_root, profiles_root, unique_schema) |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to update the
git
version in the test container, it was 2.17, needs to be >= 2.25