-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #172 from fivetran/feature/historical-schedules-ja…
…mie-redshift Feature/historical schedules jamie redshift
- Loading branch information
Showing
5 changed files
with
68 additions
and
35 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
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 |
---|---|---|
@@ -1,42 +1,45 @@ | ||
{% macro regex_extract(string, regex) -%} | ||
{% macro regex_extract(string, day) -%} | ||
|
||
{{ adapter.dispatch('regex_extract', 'zendesk') (string, regex) }} | ||
{{ adapter.dispatch('regex_extract', 'zendesk') (string, day) }} | ||
|
||
{%- endmacro %} | ||
|
||
{% macro default__regex_extract(string, regex) %} | ||
|
||
{% macro default__regex_extract(string, day) %} | ||
{% set regex = "'.*?" ~ day ~ ".*?({.*?})'" %} | ||
regexp_extract({{ string }}, {{ regex }} ) | ||
|
||
{%- endmacro %} | ||
|
||
{% macro bigquery__regex_extract(string, regex) %} | ||
|
||
{% macro bigquery__regex_extract(string, day) %} | ||
{% set regex = "'.*?" ~ day ~ ".*?({.*?})'" %} | ||
regexp_extract({{ string }}, {{ regex }} ) | ||
|
||
{%- endmacro %} | ||
|
||
{% macro snowflake__regex_extract(string, regex) %} | ||
{% macro snowflake__regex_extract(string, day) %} | ||
{% set regex = "'.*?" ~ day ~ ".*?({.*?})'" %} | ||
|
||
REGEXP_SUBSTR({{ string }}, {{ regex }}, 1, 1, 'e', 1 ) | ||
|
||
{%- endmacro %} | ||
|
||
{% macro postgres__regex_extract(string, regex) %} | ||
{% macro postgres__regex_extract(string, day) %} | ||
{% set regex = "'.*?" ~ day ~ ".*?({.*?})'" %} | ||
|
||
(regexp_matches({{ string }}, {{ regex }}))[1] | ||
|
||
{%- endmacro %} | ||
|
||
{% macro redshift__regex_extract(string, regex) %} | ||
{% macro redshift__regex_extract(string, day) %} | ||
|
||
{% set regex = '"' ~ day ~ '"' ~ ':\\\{([^\\\}]*)\\\}' -%} | ||
|
||
{% set reformatted_regex = regex | replace(".*?", ".*") | replace("{", "\\\{") | replace("}", "\\\}") -%} | ||
REGEXP_SUBSTR({{ string }}, {{ reformatted_regex }}, 1, 1, 'e') | ||
'{' || REGEXP_SUBSTR({{ string }}, '{{ regex }}', 1, 1, 'e') || '}' | ||
|
||
{%- endmacro %} | ||
|
||
{% macro spark__regex_extract(string, regex) %} | ||
{% set reformatted_regex = regex | replace("{", "\\\{") | replace("}", "\\\}") -%} | ||
regexp_extract({{ string }}, {{ reformatted_regex }}, 1) | ||
{% macro spark__regex_extract(string, day) %} | ||
{% set regex = "'.*?" ~ day ~ ".*?({.*?})'" | replace("{", "\\\{") | replace("}", "\\\}") %} | ||
regexp_extract({{ string }}, {{ regex }}, 1) | ||
|
||
{%- endmacro %} |
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