DAG をトリガーします。たとえば、手動でトリガーすることも、スケジュールに従い実行されるまで待つこともできます。
DAG の例:
importdatetimeimportosimportairflowfromairflow.providers.postgres.operators.postgresimportPostgresOperatorSQL_DATABASE=os.environ["SQL_DATABASE"]withairflow.DAG("airflow_db_connection_example",start_date=datetime.datetime(2024,1,1),schedule_interval=None,catchup=False)asdag:PostgresOperator(task_id="run_airflow_db_query",dag=dag,postgres_conn_id="airflow_db",database=SQL_DATABASE,sql="SELECT * FROM dag LIMIT 10;",)
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-02-19 UTC。"],[[["This page outlines how to connect to and query the Cloud SQL instance that hosts the Airflow database for Cloud Composer environments."],["While direct access to the Airflow database is possible, it is generally recommended to utilize the Airflow REST API or CLI commands instead."],["You can execute SQL queries on the Airflow database by creating a DAG with `PostgresOperator` operators and specifying your SQL query in the `sql` parameter, while setting schedule intervals accordingly to prevent multiple runs."],["Directly adding custom tables or modifying the schema of the Airflow database is strictly prohibited."],["Backing up the Airflow database contents should be done using snapshots rather than dumping database contents to a bucket."]]],[]]