You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "romsharon98 (via GitHub)" <gi...@apache.org> on 2023/12/29 22:05:08 UTC

[PR] prevent templated field logic checks in operators `__init__` in `BigQueryToPostgresOperator` operator [airflow]

romsharon98 opened a new pull request, #36491:
URL: https://github.com/apache/airflow/pull/36491

   related: https://github.com/apache/airflow/issues/36484
   
   fix `BigQueryToPostgresOperator` operator for this cherry-picking: https://github.com/apache/airflow/pull/33786
   <!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at
   
      http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
    -->
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of an existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   
   
   <!-- Please keep an empty line above the dashes. -->
   ---
   **^ 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 changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+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 a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [newsfragments](https://github.com/apache/airflow/tree/main/newsfragments).
   


-- 
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


Re: [PR] prevent templated field logic checks in operators `__init__` in `BigQueryToPostgresOperator` operator [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #36491:
URL: https://github.com/apache/airflow/pull/36491#discussion_r1442976636


##########
airflow/providers/google/cloud/transfers/bigquery_to_postgres.py:
##########
@@ -36,8 +34,6 @@ class BigQueryToPostgresOperator(BigQueryToSqlBaseOperator):
     :param postgres_conn_id: Reference to :ref:`postgres connection id <howto/connection:postgres>`.
     """
 
-    template_fields: Sequence[str] = (*BigQueryToSqlBaseOperator.template_fields, "dataset_id", "table_id")

Review Comment:
   I think we shoudl not treat it as breaking (or at least what I undertstand it here).
   
   I think the only scenario where it would matter is:
   
   1) Someone creates a custom operator derived from BigQueryToPostgresOperator 
   2) The same someone adds new fields there "dataset_id" and "table_id" 
   3) And expects them to be templated.
   
   Even if it worked previously, that was accidental and unintended and we should treat this change as a bug-fix. If somoene adds new fields in a derived operator it's their responsibilty to add those fields to templated fields.
   
   While this change **might** technically break someone's implementation, IMHO We should treat it as bugfix because:
   
   a) it's a very low chance this will happen
   b) while we are breaking **something** technically we are bringing things back to how they were intended to work. Having those fields in this operator was accidental not intentional 
   
   I will repeat it for as long as it sticks - SemVer and "breaking" classification is not whether something is "technically" broken but whether our intentions changed. If we woudl apply "breaking change" label for every change that changes behaviour then pretty much every single bugfix is "technically" breaking because it changes behaviour.
   



-- 
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


Re: [PR] prevent templated field logic checks in operators `__init__` in `BigQueryToPostgresOperator` operator [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #36491:
URL: https://github.com/apache/airflow/pull/36491#discussion_r1442976636


##########
airflow/providers/google/cloud/transfers/bigquery_to_postgres.py:
##########
@@ -36,8 +34,6 @@ class BigQueryToPostgresOperator(BigQueryToSqlBaseOperator):
     :param postgres_conn_id: Reference to :ref:`postgres connection id <howto/connection:postgres>`.
     """
 
-    template_fields: Sequence[str] = (*BigQueryToSqlBaseOperator.template_fields, "dataset_id", "table_id")

Review Comment:
   I think we shoudl not treat it as breaking (or at least what I undertstand it here).
   
   I think the only scenario where it would matter is:
   
   1) Someone creates a custom operator derived from BigQueryToPostgresOperator 
   2) The same someone adds new fields there "dataset_id" and "table_id" 
   3) And expects them to be templated.
   
   Even if it worked previously, that was accidental and unintended and we should treat this change as a bug-fix. If somoene adds new fields in a derived operator it's their responsibilty to add those fields to templated fields.
   
   While this change **might** technically break someone's implementation, IMHO We should treat it as bugfix because:
   
   a) it's a very low chance this will happen
   b) while we are breaking **something** technically we are bringing things back to how they were intended to work. Having those fields in this operator was accidental not intentional 
   
   I will repeat it for as long as it sticks - SemVer and "breaking" classification is not whether something is "technically" broken but whether our intentions changed. If we would apply "breaking change" label for every change that changes behaviour then pretty much every single bugfix is "technically" breaking because it changes behaviour.
   



-- 
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


Re: [PR] prevent templated field logic checks in operators `__init__` in `BigQueryToPostgresOperator` operator [airflow]

Posted by "romsharon98 (via GitHub)" <gi...@apache.org>.
romsharon98 commented on code in PR #36491:
URL: https://github.com/apache/airflow/pull/36491#discussion_r1439550974


##########
airflow/providers/google/cloud/transfers/bigquery_to_postgres.py:
##########
@@ -36,8 +34,6 @@ class BigQueryToPostgresOperator(BigQueryToSqlBaseOperator):
     :param postgres_conn_id: Reference to :ref:`postgres connection id <howto/connection:postgres>`.
     """
 
-    template_fields: Sequence[str] = (*BigQueryToSqlBaseOperator.template_fields, "dataset_id", "table_id")

Review Comment:
   Thanks for your insight @eladkal !
   Can you help me understand why is this breaking change?
   
   This is how I understand it:
   Lets assume I revert the PR, so both `"dataset_id", "table_id"` are templated field for `BigQueryToPostgresOperator`.
   
   But the parent constructor (`BigQueryToSqlBaseOperator`) always run them over by the line you mentioned.
   
   So as I understand it this reverted line has no meaning.



-- 
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


Re: [PR] prevent templated field logic checks in operators `__init__` in `BigQueryToPostgresOperator` operator [airflow]

Posted by "shahar1 (via GitHub)" <gi...@apache.org>.
shahar1 commented on code in PR #36491:
URL: https://github.com/apache/airflow/pull/36491#discussion_r1439504202


##########
airflow/providers/google/cloud/transfers/bigquery_to_postgres.py:
##########
@@ -36,8 +34,6 @@ class BigQueryToPostgresOperator(BigQueryToSqlBaseOperator):
     :param postgres_conn_id: Reference to :ref:`postgres connection id <howto/connection:postgres>`.
     """
 
-    template_fields: Sequence[str] = (*BigQueryToSqlBaseOperator.template_fields, "dataset_id", "table_id")

Review Comment:
   > Isn't this a breaking change?
   > 
   > I think the real issue is with:
   > 
   > https://github.com/apache/airflow/blob/6802d4136fab9b8a02faf22f48cb9f6d259fd523/airflow/providers/google/cloud/transfers/bigquery_to_sql.py#L96-L99
   > 
   > and it will affect all operators that inhert from the base class
   
   Coming to think of it, it might be breaking indeed as fields that don't exist in the parent's `template_fields' are removed from child's definition.
   I suggest reverting it for now.
   @romsharon98 instead of deleting this line, try to hardcode all of the values that should be templated, and see if it works (a bit ugly, but I don't have better idea for now).



-- 
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


Re: [PR] prevent templated field logic checks in operators `__init__` in `BigQueryToPostgresOperator` operator [airflow]

Posted by "shahar1 (via GitHub)" <gi...@apache.org>.
shahar1 commented on code in PR #36491:
URL: https://github.com/apache/airflow/pull/36491#discussion_r1442998946


##########
airflow/providers/google/cloud/transfers/bigquery_to_postgres.py:
##########
@@ -36,8 +34,6 @@ class BigQueryToPostgresOperator(BigQueryToSqlBaseOperator):
     :param postgres_conn_id: Reference to :ref:`postgres connection id <howto/connection:postgres>`.
     """
 
-    template_fields: Sequence[str] = (*BigQueryToSqlBaseOperator.template_fields, "dataset_id", "table_id")

Review Comment:
   > @eladkal is right - but we shiould not revert it - instead we should ad those to fields to the base class.
   
   Sounds good to me, a note
   From a technical perspective of the validation pre-commit - 
   As the validation is currently based on very simplified AST parsing, it would be better for now to define the fields directly (i.e., `template_fields = ['a','b']`), rather than relying on parents' fields (i.e, `template_fields=(**ParentClass.template_fields,'b')`)., otherwise the validation might fail.
   The cost would be minimal abuse to the inheritance, which can later be fixed.



-- 
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


Re: [PR] prevent templated field logic checks in operators `__init__` in `BigQueryToPostgresOperator` operator [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #36491:
URL: https://github.com/apache/airflow/pull/36491#discussion_r1442976636


##########
airflow/providers/google/cloud/transfers/bigquery_to_postgres.py:
##########
@@ -36,8 +34,6 @@ class BigQueryToPostgresOperator(BigQueryToSqlBaseOperator):
     :param postgres_conn_id: Reference to :ref:`postgres connection id <howto/connection:postgres>`.
     """
 
-    template_fields: Sequence[str] = (*BigQueryToSqlBaseOperator.template_fields, "dataset_id", "table_id")

Review Comment:
   I think we should not treat it as breaking (or at least what I undertstand it here).
   
   I think the only scenario where it would matter is:
   
   1) Someone creates a custom operator derived from BigQueryToPostgresOperator 
   2) The same someone adds new fields there "dataset_id" and "table_id" 
   3) And expects them to be templated.
   
   Even if it worked previously, that was accidental and unintended and we should treat this change as a bug-fix. If somoene adds new fields in a derived operator it's their responsibilty to add those fields to templated fields.
   
   While this change **might** technically break someone's implementation, IMHO We should treat it as bugfix because:
   
   a) it's a very low chance this will happen
   b) while we are breaking **something** technically we are bringing things back to how they were intended to work. Having those fields in this operator was accidental not intentional 
   
   I will repeat it for as long as it sticks - SemVer and "breaking" classification is not whether something is "technically" broken but whether our intentions changed. If we would apply "breaking change" label for every change that changes behaviour then pretty much every single bugfix is "technically" breaking because it changes behaviour.
   



-- 
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


Re: [PR] prevent templated field logic checks in operators `__init__` in `BigQueryToPostgresOperator` operator [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #36491:
URL: https://github.com/apache/airflow/pull/36491#discussion_r1443050583


##########
airflow/providers/google/cloud/transfers/bigquery_to_postgres.py:
##########
@@ -36,8 +34,6 @@ class BigQueryToPostgresOperator(BigQueryToSqlBaseOperator):
     :param postgres_conn_id: Reference to :ref:`postgres connection id <howto/connection:postgres>`.
     """
 
-    template_fields: Sequence[str] = (*BigQueryToSqlBaseOperator.template_fields, "dataset_id", "table_id")

Review Comment:
   Correct. This is really what I also proposed - to move template_fields = ['dataset_id', 'template_id'] to `BigQueryToSqlBaseOperator`. This is where they belong and this is what will make them consistent with the AST check.



-- 
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


Re: [PR] prevent templated field logic checks in operators `__init__` in `BigQueryToPostgresOperator` operator [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #36491:
URL: https://github.com/apache/airflow/pull/36491#discussion_r1442976636


##########
airflow/providers/google/cloud/transfers/bigquery_to_postgres.py:
##########
@@ -36,8 +34,6 @@ class BigQueryToPostgresOperator(BigQueryToSqlBaseOperator):
     :param postgres_conn_id: Reference to :ref:`postgres connection id <howto/connection:postgres>`.
     """
 
-    template_fields: Sequence[str] = (*BigQueryToSqlBaseOperator.template_fields, "dataset_id", "table_id")

Review Comment:
   ~I think we should not treat it as breaking (or at least what I undertstand it here).
   
   I think the only scenario where it would matter is:
   
   1) Someone creates a custom operator derived from BigQueryToPostgresOperator 
   2) The same someone adds new fields there "dataset_id" and "table_id" 
   3) And expects them to be templated.
   
   Even if it worked previously, that was accidental and unintended and we should treat this change as a bug-fix. If somoene adds new fields in a derived operator it's their responsibilty to add those fields to templated fields.
   
   While this change **might** technically break someone's implementation, IMHO We should treat it as bugfix because:
   
   a) it's a very low chance this will happen
   b) while we are breaking **something** technically we are bringing things back to how they were intended to work. Having those fields in this operator was accidental not intentional 
   
   I will repeat it for as long as it sticks - SemVer and "breaking" classification is not whether something is "technically" broken but whether our intentions changed. If we would apply "breaking change" label for every change that changes behaviour then pretty much every single bugfix is "technically" breaking because it changes behaviour.~
   
   UPDATE: I just realized I missed the parent class. Let me revise 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


Re: [PR] prevent templated field logic checks in operators `__init__` in `BigQueryToPostgresOperator` operator [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk merged PR #36491:
URL: https://github.com/apache/airflow/pull/36491


-- 
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


Re: [PR] prevent templated field logic checks in operators `__init__` in `BigQueryToPostgresOperator` operator [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #36491:
URL: https://github.com/apache/airflow/pull/36491#discussion_r1442976636


##########
airflow/providers/google/cloud/transfers/bigquery_to_postgres.py:
##########
@@ -36,8 +34,6 @@ class BigQueryToPostgresOperator(BigQueryToSqlBaseOperator):
     :param postgres_conn_id: Reference to :ref:`postgres connection id <howto/connection:postgres>`.
     """
 
-    template_fields: Sequence[str] = (*BigQueryToSqlBaseOperator.template_fields, "dataset_id", "table_id")

Review Comment:
   SCRATCH_THAT:
   
   I think we should not treat it as breaking (or at least what I undertstand it here).
   
   I think the only scenario where it would matter is:
   
   1) Someone creates a custom operator derived from BigQueryToPostgresOperator 
   2) The same someone adds new fields there "dataset_id" and "table_id" 
   3) And expects them to be templated.
   
   Even if it worked previously, that was accidental and unintended and we should treat this change as a bug-fix. If somoene adds new fields in a derived operator it's their responsibilty to add those fields to templated fields.
   
   While this change **might** technically break someone's implementation, IMHO We should treat it as bugfix because:
   
   a) it's a very low chance this will happen
   b) while we are breaking **something** technically we are bringing things back to how they were intended to work. Having those fields in this operator was accidental not intentional 
   
   I will repeat it for as long as it sticks - SemVer and "breaking" classification is not whether something is "technically" broken but whether our intentions changed. If we would apply "breaking change" label for every change that changes behaviour then pretty much every single bugfix is "technically" breaking because it changes behaviour.
   
   UPDATE: I just realized I missed the parent class. Let me revise 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


Re: [PR] prevent templated field logic checks in operators `__init__` in `BigQueryToPostgresOperator` operator [airflow]

Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal commented on code in PR #36491:
URL: https://github.com/apache/airflow/pull/36491#discussion_r1445052492


##########
airflow/providers/google/cloud/transfers/bigquery_to_postgres.py:
##########
@@ -36,8 +34,6 @@ class BigQueryToPostgresOperator(BigQueryToSqlBaseOperator):
     :param postgres_conn_id: Reference to :ref:`postgres connection id <howto/connection:postgres>`.
     """
 
-    template_fields: Sequence[str] = (*BigQueryToSqlBaseOperator.template_fields, "dataset_id", "table_id")

Review Comment:
   Followup PR https://github.com/apache/airflow/pull/36663



-- 
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


Re: [PR] prevent templated field logic checks in operators `__init__` in `BigQueryToPostgresOperator` operator [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #36491:
URL: https://github.com/apache/airflow/pull/36491#discussion_r1442976636


##########
airflow/providers/google/cloud/transfers/bigquery_to_postgres.py:
##########
@@ -36,8 +34,6 @@ class BigQueryToPostgresOperator(BigQueryToSqlBaseOperator):
     :param postgres_conn_id: Reference to :ref:`postgres connection id <howto/connection:postgres>`.
     """
 
-    template_fields: Sequence[str] = (*BigQueryToSqlBaseOperator.template_fields, "dataset_id", "table_id")

Review Comment:
   I think we should not treat it as breaking (or at least what I undertstand it here).
   
   I think the only scenario where it would matter is:
   
   1) Someone creates a custom operator derived from BigQueryToPostgresOperator 
   2) The same someone adds new fields there "dataset_id" and "table_id" 
   3) And expects them to be templated.
   
   Even if it worked previously, that was accidental and unintended and we should treat this change as a bug-fix. If somoene adds new fields in a derived operator it's their responsibilty to add those fields to templated fields.
   
   While this change **might** technically break someone's implementation, IMHO We should treat it as bugfix because:
   
   a) it's a very low chance this will happen
   b) while we are breaking **something** technically we are bringing things back to how they were intended to work. Having those fields in this operator was accidental not intentional 
   
   I will repeat it for as long as it sticks - SemVer and "breaking" classification is not whether something is "technically" broken but whether our intentions changed. If we would apply "breaking change" label for every change that changes behaviour then pretty much every single bugfix is "technically" breaking because it changes behaviour.
   
   UPDATE: I just realized I missed the parent class. Let me revise 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


Re: [PR] prevent templated field logic checks in operators `__init__` in `BigQueryToPostgresOperator` operator [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #36491:
URL: https://github.com/apache/airflow/pull/36491#discussion_r1442987543


##########
airflow/providers/google/cloud/transfers/bigquery_to_postgres.py:
##########
@@ -36,8 +34,6 @@ class BigQueryToPostgresOperator(BigQueryToSqlBaseOperator):
     :param postgres_conn_id: Reference to :ref:`postgres connection id <howto/connection:postgres>`.
     """
 
-    template_fields: Sequence[str] = (*BigQueryToSqlBaseOperator.template_fields, "dataset_id", "table_id")

Review Comment:
   @eladkal is right - but we shiould not revert it - instead we should ad those to fields to the base class.



-- 
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


Re: [PR] prevent templated field logic checks in operators `__init__` in `BigQueryToPostgresOperator` operator [airflow]

Posted by "shahar1 (via GitHub)" <gi...@apache.org>.
shahar1 commented on code in PR #36491:
URL: https://github.com/apache/airflow/pull/36491#discussion_r1442998946


##########
airflow/providers/google/cloud/transfers/bigquery_to_postgres.py:
##########
@@ -36,8 +34,6 @@ class BigQueryToPostgresOperator(BigQueryToSqlBaseOperator):
     :param postgres_conn_id: Reference to :ref:`postgres connection id <howto/connection:postgres>`.
     """
 
-    template_fields: Sequence[str] = (*BigQueryToSqlBaseOperator.template_fields, "dataset_id", "table_id")

Review Comment:
   > @eladkal is right - but we shiould not revert it - instead we should ad those to fields to the base class.
   
   Sounds good to me.
   A note from a technical perspective of the validation pre-commit - 
   As the validation is currently based on very simplified AST parsing, it would be better for now to define the fields directly (i.e., `template_fields = ['a','b']`), rather than relying on parents' fields (i.e, `template_fields=(**ParentClass.template_fields,'b')`)., otherwise the validation might fail.
   The cost would be minimal abuse to the inheritance, which can later be fixed.



-- 
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


Re: [PR] prevent templated field logic checks in operators `__init__` in `BigQueryToPostgresOperator` operator [airflow]

Posted by "shahar1 (via GitHub)" <gi...@apache.org>.
shahar1 commented on code in PR #36491:
URL: https://github.com/apache/airflow/pull/36491#discussion_r1439504202


##########
airflow/providers/google/cloud/transfers/bigquery_to_postgres.py:
##########
@@ -36,8 +34,6 @@ class BigQueryToPostgresOperator(BigQueryToSqlBaseOperator):
     :param postgres_conn_id: Reference to :ref:`postgres connection id <howto/connection:postgres>`.
     """
 
-    template_fields: Sequence[str] = (*BigQueryToSqlBaseOperator.template_fields, "dataset_id", "table_id")

Review Comment:
   > Isn't this a breaking change?
   > 
   > I think the real issue is with:
   > 
   > https://github.com/apache/airflow/blob/6802d4136fab9b8a02faf22f48cb9f6d259fd523/airflow/providers/google/cloud/transfers/bigquery_to_sql.py#L96-L99
   > 
   > and it will affect all operators that inhert from the base class
   
   Coming to think of it, it might be breaking indeed as fields that don't exist in the parent's `template_fields` are removed from child's definition.
   I suggest reverting it for now.
   @romsharon98 instead of deleting this line, try to hardcode all of the values that should be templated, and see if it works (a bit ugly, but I don't have better idea for now).



-- 
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


Re: [PR] prevent templated field logic checks in operators `__init__` in `BigQueryToPostgresOperator` operator [airflow]

Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal commented on code in PR #36491:
URL: https://github.com/apache/airflow/pull/36491#discussion_r1439449441


##########
airflow/providers/google/cloud/transfers/bigquery_to_postgres.py:
##########
@@ -36,8 +34,6 @@ class BigQueryToPostgresOperator(BigQueryToSqlBaseOperator):
     :param postgres_conn_id: Reference to :ref:`postgres connection id <howto/connection:postgres>`.
     """
 
-    template_fields: Sequence[str] = (*BigQueryToSqlBaseOperator.template_fields, "dataset_id", "table_id")

Review Comment:
   Isn't this a breaking change?
   
   I think the real issue is with:
   
   https://github.com/apache/airflow/blob/6802d4136fab9b8a02faf22f48cb9f6d259fd523/airflow/providers/google/cloud/transfers/bigquery_to_sql.py#L96-L99
   
   and it will affect all operators that inhert from the base class



-- 
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