-
Notifications
You must be signed in to change notification settings - Fork 427
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Fix file format csv parameters config Fixes #2176 * Fix show by id for dynamic table Fixes #2173 * Add helper method * Refactor test * Fix 2134 Fixes #2134 * Fix 1947 Fixes #1947 * Fix fmt * Fix after review
- Loading branch information
1 parent
1d08c46
commit 98d8ccc
Showing
15 changed files
with
474 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package resources | ||
|
||
import ( | ||
"strings" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
) | ||
|
||
// DiffSuppressStatement will suppress diffs between statements if they differ in only case or in | ||
// runs of whitespace (\s+ = \s). This is needed because the snowflake api does not faithfully | ||
// round-trip queries, so we cannot do a simple character-wise comparison to detect changes. | ||
// | ||
// Warnings: We will have false positives in cases where a change in case or run of whitespace is | ||
// semantically significant. | ||
// | ||
// If we can find a sql parser that can handle the snowflake dialect then we should switch to parsing | ||
// queries and either comparing ASTs or emitting a canonical serialization for comparison. I couldn't | ||
// find such a library. | ||
func DiffSuppressStatement(_, old, new string, _ *schema.ResourceData) bool { | ||
return strings.EqualFold(normalizeQuery(old), normalizeQuery(new)) | ||
} | ||
|
||
func normalizeQuery(str string) string { | ||
return strings.TrimSpace(space.ReplaceAllString(str, " ")) | ||
} |
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
Oops, something went wrong.