Skip to content
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

feat(FIR-36505): add where clause to copy from #149

Merged
merged 4 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changes/unreleased/Added-20240918-180154.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: Added
body: Added ability to specify where clause in config for COPY FROM command
time: 2024-09-18T18:01:54.377992+01:00
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ sources:
skip_blank_lines: true
date_format: 'YYYY-MM-DD'
timestamp_format: 'YYYY-MM-DD HH24:MI:SS'

where: "$source_file_timestamp > NOW() - interval '6 YEARS'"
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
{# COPY FROM is only available in Firebolt 2.0. #}
{%- set external = source_node.external -%}
{%- set credentials = external.credentials -%}
{%- set where_clause = external.where -%}
{%- set options = external.options -%}
{%- set csv_options = options.csv_options -%}
{%- set error_file_credentials = options.error_file_credentials -%}
Expand All @@ -75,7 +76,7 @@
)
{%- endif %}
FROM '{{external.url}}'
{%- if options %}
{%- if options or credentials %}
WITH
{%- if options.object_pattern %}
PATTERN = '{{options.object_pattern}}'
Expand Down Expand Up @@ -130,8 +131,11 @@
TIMESTAMP_FORMAT = '{{ csv_options.timestamp_format }}'
{%- endif %}
{%- endif %}
{%- if credentials %}
CREDENTIALS = (AWS_KEY_ID = '{{credentials.aws_key_id}}' AWS_SECRET_KEY = '{{credentials.aws_secret_key}}')
{%- endif %}
{%- endif %}
{%- if credentials %}
CREDENTIALS = (AWS_KEY_ID = '{{credentials.aws_key_id}}' AWS_SECRET_KEY = '{{credentials.aws_secret_key}}')
{%- if where_clause %}
WHERE {{ where_clause }}
{%- endif %}
{% endmacro %}
Loading