-
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
Quote config #742
Merged
Merged
Quote config #742
Changes from 8 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
9fe9ca8
global quoting config
a0dedfa
fix default quoting config in project
9a635ca
merged implement-relations-api
4a550e5
relations, fix another merge conflict
ba58e7e
seed + relations
2f54e52
fix unit tests
1c61341
add snowflake quoting off tests
396ea65
Merge branch 'implement-relations-api' of github.com:fishtown-analyti…
852a0eb
Merge branch 'implement-relations-api' into quote-config
drewbanin 5bafcd6
fix exception code for seed onto view
drewbanin ac62a4d
projects everywhere
8ee8e76
test fixes
dd707c8
switch test, fix schema creation / dropping
e269c25
quote tests properly
8cc3696
spruce up snowflake warning, add link
drewbanin a661512
fix snowflake tests
41aa908
Merge branch 'quote-config' of github.com:fishtown-analytics/dbt into…
126ab23
add already_exists tests
drewbanin e564dee
fix for incremental models, plus test
drewbanin d33ec80
fix unit tests, pep8
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
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 |
---|---|---|
|
@@ -175,6 +175,7 @@ def invoke_dbt(parsed): | |
profile_to_load=parsed.profile, | ||
args=parsed | ||
) | ||
proj.log_warnings() | ||
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. we should do this check on line 235. If |
||
proj.validate() | ||
except project.DbtProjectError as e: | ||
logger.info("Encountered an error while reading the project:") | ||
|
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 |
---|---|---|
|
@@ -91,6 +91,9 @@ def __init__(self, cfg, profiles, profiles_dir, profile_to_load=None, | |
if self.cfg.get('models') is None: | ||
self.cfg['models'] = {} | ||
|
||
if self.cfg.get('quoting') is None: | ||
self.cfg['quoting'] = {} | ||
|
||
if self.cfg['models'].get('vars') is None: | ||
self.cfg['models']['vars'] = {} | ||
|
||
|
@@ -223,6 +226,21 @@ def validate(self): | |
"Expected project configuration '{}' was not supplied" | ||
.format('.'.join(e.path)), self) | ||
|
||
def log_warnings(self): | ||
target_cfg = self.run_environment() | ||
db_type = target_cfg.get('type') | ||
|
||
if db_type == 'snowflake' and self.cfg \ | ||
.get('quoting', {}) \ | ||
.get('identifier') is None: | ||
logger.warn( | ||
'You are using Snowflake, but you did not specify a ' | ||
'quoting strategy for your identifiers. Quoting ' | ||
'behavior for Snowflake will change in a future release, ' | ||
'so it is recommended that you define this explicitly. ' | ||
'\n\n' | ||
'For more information, see ADD LINK') | ||
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. TODO |
||
|
||
def hashed_name(self): | ||
if self.cfg.get("name", None) is None: | ||
return None | ||
|
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 |
---|---|---|
|
@@ -28,6 +28,7 @@ | |
'vars', | ||
'column_types', | ||
'bind', | ||
'quoting', | ||
] | ||
|
||
|
||
|
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 |
---|---|---|
|
@@ -6,4 +6,4 @@ | |
) | ||
}} | ||
|
||
select * from {{ target.schema }}.seed | ||
select * from {{ ref('seed') }} |
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 |
---|---|---|
|
@@ -5,4 +5,4 @@ | |
) | ||
}} | ||
|
||
select * from {{ target.schema }}.seed | ||
select * from {{ ref('seed') }} |
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 |
---|---|---|
|
@@ -5,4 +5,4 @@ | |
) | ||
}} | ||
|
||
select * from {{ target.schema }}.seed | ||
select * from {{ ref('seed') }} |
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 |
---|---|---|
|
@@ -6,4 +6,4 @@ | |
) | ||
}} | ||
|
||
select * from {{ target.schema }}.seed | ||
select * from {{ ref('seed') }} |
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 |
---|---|---|
|
@@ -5,4 +5,4 @@ | |
}} | ||
|
||
-- this is a unicode character: å | ||
select * from {{ target.schema }}.seed | ||
select * from {{ ref('seed') }} |
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 |
---|---|---|
|
@@ -4,4 +4,4 @@ | |
) | ||
}} | ||
|
||
select * from {{ target.schema }}.seed | ||
select * from {{ ref('seed') }} |
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.
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.
should we quote both schema and identifier here? Feels weird to do one and not the other