josh-fell commented on a change in pull request #20422:
URL: https://github.com/apache/airflow/pull/20422#discussion_r772475050
##########
File path:
airflow/providers/apache/cassandra/example_dags/example_cassandra_dag.py
##########
@@ -35,7 +35,9 @@
catchup=False,
tags=['example'],
) as dag:
- table_sensor = CassandraTableSensor(task_id="cassandra_table_sensor")
+ table_sensor = CassandraTableSensor(task_id="cassandra_table_sensor",
table="table")
- record_sensor = CassandraRecordSensor(task_id="cassandra_record_sensor",
keys={"p1": "v1", "p2": "v2"})
+ record_sensor = CassandraRecordSensor(
+ task_id="cassandra_record_sensor", keys={"p1": "v1", "p2": "v2"},
table="table"
+ )
Review comment:
Random idea I just played around with that seemed for work here. What if
we created a stub file for the example DAG?
`airflow/providers/apache/cassandra/example_dags/example_cassandra_dag.pyi`
```python
from typing import Any, Dict
from airflow.providers.apache.cassandra.hooks.cassandra import CassandraHook
from airflow.providers.apache.cassandra.sensors.record import
CassandraRecordSensor as _CassandraRecordSensor
from airflow.providers.apache.cassandra.sensors.table import
CassandraTableSensor as _CassandraTableSensor
class CassandraTableSensor(_CassandraTableSensor):
def __init__(
self, *, table: str = ..., cassandra_conn_id: str =
CassandraHook.default_conn_name, **kwargs: Any
) -> None:
...
class CassandraRecordSensor(_CassandraRecordSensor):
def __init__(
self,
*,
table: str = ...,
keys: Dict[str, str] = ...,
cassandra_conn_id: str = CassandraHook.default_conn_name,
**kwargs: Any,
) -> None:
...
```
We don't have to change the operator logic or the example DAG itself and
Mypy seems happy.
--
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]