Add airflowctl as SDK initial example to HowTo guide#63017
Add airflowctl as SDK initial example to HowTo guide#63017bugraoz93 wants to merge 1 commit intoapache:mainfrom
Conversation
| .. code-block:: python | ||
|
|
||
| import httpx | ||
| from airflow_ctl.api.client import Client, Credentials, ServerResponseError | ||
| from airflowctl.api.datamodels.generated import DAGPatchBody | ||
|
|
||
| # Reusable API Client until token expires | ||
| api_client = Client( | ||
| base_url="AIRFLOW_API_URL", | ||
| limits=httpx.Limits(max_keepalive_connections=1, max_connections=1), | ||
| token="TOKEN", | ||
| ) | ||
|
|
||
| # Example: Pausing a DAG | ||
| dag_id = "EXAMPLE_DAG_ID" | ||
| try: | ||
| api_client.dags.update(dag_id=dag_id, dag_body=DAGPatchBody(is_paused="pause")) | ||
| except ServerResponseError as e: | ||
| # Handle error | ||
| pass |
There was a problem hiding this comment.
Why do you want to open that can of worms :D -- then you will need to keep this interface too!
There was a problem hiding this comment.
This is exact comment I needed Kaxil, thanks :D
I wasn't fully sure until we have full parity and auto generation for all endpoints without having LoC. I thought it could be maybe useful for some small cases so maybe we can have early feedback to construct naturally rather big bang. Still agree on additional effort.
I am not persistent to open it while wanted to collect feedback on this :)
Maybe after 1.0 and things started evolving more stable 🤔
Please let me know your thoughts, really valuable :)
There was a problem hiding this comment.
haha yeah I had say keep airflowctl only for CLI -- the only public interface is CLI interaction -- so we can change anything internal as long as CLI works the same - same args/params etc.
We already have https://github.com/apache/airflow-client-python -- although it is tied to a version.
Keep version compat for a library is very difficult over CLI. So I'd suggest don't recommend this to the users :)
There was a problem hiding this comment.
Indeed, started a discussion on version compatibility and raised a solution even though not the best but it works.
True, even internal small changes goes breaking easily.
Even tied to Pydantic not easily solve everything. Closing this, thanks Kaxil! :)
Was generative AI tooling used to co-author this PR?
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.