arthur-plautz opened a new pull request, #51254:
URL: https://github.com/apache/airflow/pull/51254

   <!--
    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. -->
   ---
   
   The goal of this draft is to discuss the inclusion of two classes 
representing different approaches on achieving Change Data Capture at some 
level in the airflow context:
   - **Table Row Count**: A simple approach for getting changes from an 
external table without the overhead of previous configuration or exploration. 
For some use cases, not having reliable columns may impose a challenge to many 
CDC approaches, thus, the idea of capturing the row count presents a simpler 
alternative that wouldn't require any prerequisites other than a working 
connection with the database.
   - **Logical Replication**: CDC at transaction level. This is a more robust 
solution that requires a certain level of control over the target database and 
the replication itself. The details and prerequisites for this approach are 
detailed in the [Postgres Logical 
Replication](https://www.postgresql.org/docs/current/logical-replication.html) 
documentation, this approach assumes that the user has the knowledge and access 
to perform the required steps to achieve database logical replication.
   
   Since the operations related to these triggers are mostly I/O bound, using a 
synchronous connection to periodically operate in the triggerer loop may cause 
performance problems, specially when dealing with small `poke_interval` values. 
This solution is presented here as the first go to option, observing the well 
established use of the [Postgres 
Hook](https://airflow.apache.org/docs/apache-airflow-providers-postgres/stable/_api/airflow/providers/postgres/hooks/postgres/index.html).
 Alternatively, using the [asyncpg](https://github.com/MagicStack/asyncpg) 
library may be an option, with the cost of introducing an additional dependency 
and a different implementation on Postgres connection.
   
   The decision on the state tracking mechanism required for both approaches is 
still open to discussion, although the current intended design choice leans 
towards the one proposed in the 
[AIP-30](https://cwiki.apache.org/confluence/display/AIRFLOW/AIP-30%3A+State+persistence).
   
   Tests, examples and documentation will be added soon.
   
   A similar proposal is presented in the PR linked below, although the nature 
of the changes is complementary to this work. 
   Related: [51056](https://github.com/apache/airflow/pull/51056)


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to