Skip to content

Add airflowctl as SDK initial example to HowTo guide#63017

Closed
bugraoz93 wants to merge 1 commit intoapache:mainfrom
bugraoz93:initial-documentation-of-airflowctl-as-sdk
Closed

Add airflowctl as SDK initial example to HowTo guide#63017
bugraoz93 wants to merge 1 commit intoapache:mainfrom
bugraoz93:initial-documentation-of-airflowctl-as-sdk

Conversation

@bugraoz93
Copy link
Contributor


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {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.

@bugraoz93 bugraoz93 changed the title Add airflowctl as SDK example to HowTo guide Add airflowctl as SDK initial example to HowTo guide Mar 6, 2026
Comment on lines +124 to +143
.. 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you want to open that can of worms :D -- then you will need to keep this interface too!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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! :)

@bugraoz93 bugraoz93 closed this Mar 7, 2026
@bugraoz93 bugraoz93 deleted the initial-documentation-of-airflowctl-as-sdk branch March 7, 2026 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants