dwreeves opened a new issue, #56508:
URL: https://github.com/apache/airflow/issues/56508

   ### Description
   
   I'm not sure how big this is, but I imagine this is small enough to not 
require an AIP.
   
   Example of what this could look like:
   
   ```python
   from airflow.plugins_manager import AirflowPlugin
   from airflow.cli.cli_config import (
       ActionCommand,
       GroupCommand,
   )
   
   
   def function():
       print("Hello, world!")
   
   
   class ExamplePlugin(AirflowPlugin):
       name = "example"
       cli_commands = [
           GroupCommand(
               name="example",
               help="Example command from plugin",
               description=(
                   "This runs all example commands"
               ),
               subcommands=[
                   ActionCommand(
                       name="subcommand",
                       help="Run a subcommand",
                       func=function,
                   )
               ],
           ),
       ]
   ```
   
   ### Use case/motivation
   
   The main motivation that comes to mind is Cosmos: 
https://github.com/astronomer/astronomer-cosmos Cosmos is a library that runs 
dbt in Airflow. dbt is a command-line tool that orchestrates, manages, and runs 
SQL queries. It would be a big quality-of-life upgrade if Cosmos were able to 
execute `dbt` commands with something like: `airflow cosmos --project foo dbt 
run --select bar`.
   
   Right now many users struggle to execute dbt via the command line when it's 
configured for Airflow. I personally use a weird setup to execute one-off runs 
of dbt models that I expect many users would not know how to do themselves.
   
   Some advantages for Cosmos, and more generally:
   
   - Would hook easily into config configured in the user's Airflow instance.
   - Could be used to execute one-off commands. This is a popular use case for 
dbt; many more savvy users already have an unscheduled parameterized DAG 
devoted to executing manual dbt commands. There are, however, many other 
commands that users might want to run directly from the CLI. E.g. imagine if 
something like the [maintenance 
DAGs](https://github.com/teamclairvoyant/airflow-maintenance-dags) repo had a 
CLI.
   
   ### Related issues
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [x] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


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