Skip to content

Commit

Permalink
Add Template Fields to RedshiftToS3Operator & S3ToRedshiftOperator (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
rynmccrmck committed Oct 29, 2020
1 parent 9320fe6 commit 8222851
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion airflow/providers/amazon/aws/transfers/redshift_to_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class RedshiftToS3Operator(BaseOperator):
:type table_as_file_name: bool
"""

template_fields = ('s3_key',)
template_fields = ('s3_bucket', 's3_key', 'schema', 'table', 'unload_options')
template_ext = ()
ui_color = '#ededed'

Expand Down
5 changes: 1 addition & 4 deletions airflow/providers/amazon/aws/transfers/s3_to_redshift.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@ class S3ToRedshiftOperator(BaseOperator):
:type truncate_table: bool
"""

template_fields = (
's3_key',
'table',
)
template_fields = ('s3_bucket', 's3_key', 'schema', 'table', 'copy_options')
template_ext = ()
ui_color = '#99e699'

Expand Down
5 changes: 5 additions & 0 deletions tests/providers/amazon/aws/transfers/test_redshift_to_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,8 @@ def test_execute(

assert mock_run.call_count == 1
assert_equal_ignore_multiple_spaces(self, mock_run.call_args[0][0], unload_query)

def test_template_fields_overrides(self):
self.assertEqual(
RedshiftToS3Operator.template_fields, ('s3_bucket', 's3_key', 'schema', 'table', 'unload_options')
)
5 changes: 5 additions & 0 deletions tests/providers/amazon/aws/transfers/test_s3_to_redshift.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,8 @@ def test_truncate(self, mock_run, mock_session):
assert_equal_ignore_multiple_spaces(self, mock_run.call_args[0][0], transaction)

assert mock_run.call_count == 1

def test_template_fields_overrides(self):
self.assertEqual(
S3ToRedshiftOperator.template_fields, ('s3_bucket', 's3_key', 'schema', 'table', 'copy_options')
)

0 comments on commit 8222851

Please sign in to comment.