You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/02/07 21:51:58 UTC

[GitHub] [airflow] josh-fell opened a new pull request #21403: Update `template_fields_renderers` using new SQL lexers to "sql" renderer

josh-fell opened a new pull request #21403:
URL: https://github.com/apache/airflow/pull/21403


   Related: #21237 #21348
   
   New SQL lexers were added as part of #21237, however, these new lexers won't be available for use as `template_fields_renderers` in operators until Airflow 2.3. This PR updates operators using these lexers to the "sql" renderer for now.
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/main/UPDATING.md).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #21403: Add conditional `template_fields_renderers` check for new SQL lexers

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #21403:
URL: https://github.com/apache/airflow/pull/21403#issuecomment-1032388946


   Just the dreaded docker-compose check (need to fix it)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on a change in pull request #21403: Update `template_fields_renderers` using new SQL lexers to "sql" renderer

Posted by GitBox <gi...@apache.org>.
potiuk commented on a change in pull request #21403:
URL: https://github.com/apache/airflow/pull/21403#discussion_r801100375



##########
File path: airflow/providers/amazon/aws/operators/redshift_sql.py
##########
@@ -44,7 +44,8 @@ class RedshiftSQLOperator(BaseOperator):
 
     template_fields: Sequence[str] = ('sql',)
     template_ext: Sequence[str] = ('.sql',)
-    template_fields_renderers = {"sql": "postgresql"}
+    # TODO: Update ``sql`` renderer to "postgresql" when the lexer is available in Airflow 2.3.0.
+    template_fields_renderers = {"sql": "sql"}

Review comment:
       something like that should work :)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk merged pull request #21403: Add conditional `template_fields_renderers` check for new SQL lexers

Posted by GitBox <gi...@apache.org>.
potiuk merged pull request #21403:
URL: https://github.com/apache/airflow/pull/21403


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on a change in pull request #21403: Update `template_fields_renderers` using new SQL lexers to "sql" renderer

Posted by GitBox <gi...@apache.org>.
potiuk commented on a change in pull request #21403:
URL: https://github.com/apache/airflow/pull/21403#discussion_r801098384



##########
File path: airflow/providers/amazon/aws/operators/redshift_sql.py
##########
@@ -44,7 +44,8 @@ class RedshiftSQLOperator(BaseOperator):
 
     template_fields: Sequence[str] = ('sql',)
     template_ext: Sequence[str] = ('.sql',)
-    template_fields_renderers = {"sql": "postgresql"}
+    # TODO: Update ``sql`` renderer to "postgresql" when the lexer is available in Airflow 2.3.0.

Review comment:
       I  think it would be better to dynamically check the renderers available in this case. Otherwise, even if we release 2.3.0, we will not be able to change it as the providers are 2.1.0+ 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] josh-fell commented on a change in pull request #21403: Update `template_fields_renderers` using new SQL lexers to "sql" renderer

Posted by GitBox <gi...@apache.org>.
josh-fell commented on a change in pull request #21403:
URL: https://github.com/apache/airflow/pull/21403#discussion_r801100278



##########
File path: airflow/providers/amazon/aws/operators/redshift_sql.py
##########
@@ -44,7 +44,8 @@ class RedshiftSQLOperator(BaseOperator):
 
     template_fields: Sequence[str] = ('sql',)
     template_ext: Sequence[str] = ('.sql',)
-    template_fields_renderers = {"sql": "postgresql"}
+    # TODO: Update ``sql`` renderer to "postgresql" when the lexer is available in Airflow 2.3.0.

Review comment:
       Ah you're right. I'll update.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on a change in pull request #21403: Update `template_fields_renderers` using new SQL lexers to "sql" renderer

Posted by GitBox <gi...@apache.org>.
potiuk commented on a change in pull request #21403:
URL: https://github.com/apache/airflow/pull/21403#discussion_r801100269



##########
File path: airflow/providers/amazon/aws/operators/redshift_sql.py
##########
@@ -44,7 +44,8 @@ class RedshiftSQLOperator(BaseOperator):
 
     template_fields: Sequence[str] = ('sql',)
     template_ext: Sequence[str] = ('.sql',)
-    template_fields_renderers = {"sql": "postgresql"}
+    # TODO: Update ``sql`` renderer to "postgresql" when the lexer is available in Airflow 2.3.0.
+    template_fields_renderers = {"sql": "sql"}

Review comment:
       ```suggestion
       template_fields_renderers = {"sql": "postgresql"} if  'postgresql' in get_attr_renderer() else {"sql": "sql"}
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] josh-fell commented on pull request #21403: Update `template_fields_renderers` using new SQL lexers to "sql" renderer

Posted by GitBox <gi...@apache.org>.
josh-fell commented on pull request #21403:
URL: https://github.com/apache/airflow/pull/21403#issuecomment-1031968398


   CC @potiuk 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org