-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix the ambiguous alias exception to respect databases
The alias name check is now tied to the behavior of adapter.Relation.create_from(...) Plugins that override the `include` of their relations will use whatever they render to for the check the actual exception-raising code gets the name that was compared instead of generating its own Finally, I added a reasonable fallback behavior since this method was exposed to the context
- Loading branch information
Jacob Beck
committed
May 1, 2020
1 parent
68babfb
commit 20c5c4c
Showing
8 changed files
with
71 additions
and
10 deletions.
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
2 changes: 2 additions & 0 deletions
2
test/integration/026_aliases_test/models-dupe-custom-database/README.md
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
these should succeed, as both models have the same alias, | ||
but they are configured to be built in _different_ schemas |
1 change: 1 addition & 0 deletions
1
test/integration/026_aliases_test/models-dupe-custom-database/model_a.sql
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
select {{ string_literal(this.name) }} as tablename |
1 change: 1 addition & 0 deletions
1
test/integration/026_aliases_test/models-dupe-custom-database/model_b.sql
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
select {{ string_literal(this.name) }} as tablename |
12 changes: 12 additions & 0 deletions
12
test/integration/026_aliases_test/models-dupe-custom-database/schema.yml
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
version: 2 | ||
models: | ||
- name: model_a | ||
tests: | ||
- expect_value: | ||
field: tablename | ||
value: duped_alias | ||
- name: model_b | ||
tests: | ||
- expect_value: | ||
field: tablename | ||
value: duped_alias |
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