{"id":606,"library":"apache-airflow-providers-common-sql","title":"Apache Airflow Common SQL Provider","description":"The `apache-airflow-providers-common-sql` package provides a foundational set of SQL-related functionalities for Apache Airflow, including operators, hooks, sensors, and triggers for interacting with various SQL databases. It leverages SQLAlchemy for seamless integration and simplifies connection management. As of its current version 1.34.0, it is actively maintained with regular updates.","status":"active","version":"1.34.0","language":"python","source_language":"en","source_url":"https://github.com/apache/airflow/tree/main/airflow/providers/common/sql","tags":["airflow","airflow-provider","sql","database","etl","data-quality"],"install":[{"cmd":"pip install apache-airflow-providers-common-sql","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Required for SQL parsing capabilities within some operators.","package":"sqlparse","optional":false},{"reason":"This is an Airflow provider; it requires Apache Airflow. Minimum supported version is 2.11.0 (for provider version 1.33.0+), though earlier provider versions supported Airflow 2.4.0+.","package":"apache-airflow","optional":false}],"imports":[{"symbol":"SQLExecuteQueryOperator","correct":"from airflow.providers.common.sql.operators.sql import SQLExecuteQueryOperator"},{"symbol":"SQLColumnCheckOperator","correct":"from airflow.providers.common.sql.operators.sql import SQLColumnCheckOperator"},{"symbol":"SQLTableCheckOperator","correct":"from airflow.providers.common.sql.operators.sql import SQLTableCheckOperator"},{"symbol":"DbApiHook","correct":"from airflow.providers.common.sql.hooks.sql import DbApiHook"},{"symbol":"SqlSensor","correct":"from airflow.providers.common.sql.sensors.sql import SqlSensor"}],"quickstart":{"code":"from airflow import DAG\nfrom airflow.providers.common.sql.operators.sql import SQLExecuteQueryOperator\nfrom datetime import datetime\n\nwith DAG(\n    'sql_example_dag',\n    start_date=datetime(2023, 1, 1),\n    schedule_interval=None,\n    catchup=False,\n    tags=['sql', 'example']\n) as dag:\n    # Ensure 'my_database_conn' is configured in Airflow Connections\n    execute_query_task = SQLExecuteQueryOperator(\n        task_id='run_simple_sql_query',\n        conn_id='my_database_conn',\n        sql='SELECT 1;'\n    )\n\n    # Example of running a SQL query from a file\n    # For this to work, you would typically place 'my_query.sql' in your DAGs folder's 'include' directory,\n    # or set the template_searchpath in the DAG definition.\n    # For demonstration, we'll use a placeholder string.\n    execute_templated_query = SQLExecuteQueryOperator(\n        task_id='run_templated_sql_query',\n        conn_id='my_database_conn',\n        sql=\"\"\"SELECT * FROM users WHERE registration_date < '{{ ds }}';\"\"\",\n        parameters={'table_name': 'users'}\n    )","lang":"python","description":"This quickstart demonstrates how to define a simple Airflow DAG using the `SQLExecuteQueryOperator` to execute SQL queries. It shows both a direct SQL string execution and an example of a templated SQL query that could load from a file."},"warnings":[{"fix":"Upgrade Airflow to at least 2.9.0 and refactor DAGs to use current, non-deprecated APIs. Consult the official changelog for specific removals.","message":"Provider version 1.33.0 (and later) removes all deprecated classes, parameters, and features. Users with very old provider versions or custom code relying on private functions of `common.sql` might experience issues. This release is only available for Airflow 2.9+.","severity":"breaking","affected_versions":">=1.33.0"},{"fix":"Avoid installing `apache-airflow-providers-common-sql==1.3.0`. Downgrade to `1.2.0` or upgrade to a later compatible version (e.g., `1.3.4` or newer for common-sql, and potentially `8.5.0` or newer for google provider, depending on Airflow version).","message":"The `apache-airflow-providers-common-sql==1.3.0` release was known to break BigQuery operators from `apache-airflow-providers-google==8.4.0` due to implicit dependencies and refactoring. This resulted in `1.3.0` being yanked.","severity":"breaking","affected_versions":"1.3.0"},{"fix":"Do not use `apache-airflow-providers-common-sql==1.3.0` or `==1.5.0`. Ensure your `requirements.txt` or `pip install` commands specify a working version range.","message":"Provider versions `1.3.0` and `1.5.0` were yanked from PyPI due to potential issues: `1.3.0` broke BigQuery operators, and `1.5.0` could cause unconstrained installation of old Airflow versions leading to `RuntimeError`.","severity":"breaking","affected_versions":"1.3.0, 1.5.0"},{"fix":"Ensure your Airflow installation meets the minimum requirement for the desired provider version (e.g., Airflow 2.11.0 for provider 1.33.0+). Do not attempt to install this provider with Airflow versions lower than its minimum requirement.","message":"The `apache-airflow-providers-common-sql` package is preinstalled by default with Apache Airflow (since Airflow 2.4.0+). While it can be upgraded independently, attempting to install it separately on a system with an older Airflow version (e.g., <2.4.0) will fail at runtime, even if not explicitly specified in dependencies, due to internal compatibility checks.","severity":"gotcha","affected_versions":"<2.4.0 (for Airflow version)"},{"fix":"Upgrade `apache-airflow-providers-common-sql` to version `1.24.1` or higher to fix this vulnerability.","message":"A SQL Injection vulnerability (CVE-2025-30473) existed in `SQLTableCheckOperator` when using the `partition_clause` parameter with externally-influenced input. An authenticated UI user could inject arbitrary SQL commands.","severity":"breaking","affected_versions":"<1.24.1"},{"fix":"Refactor your DAG definition to use the `schedule` parameter instead of `schedule_interval` (e.g., `schedule='@daily'` or `schedule=timedelta(days=1)`).","message":"The `schedule_interval` parameter in the `DAG` class was deprecated in Airflow 2.0 and completely removed in Airflow 2.2. Using it with Airflow versions 2.2.0 or newer will result in a `TypeError`.","severity":"breaking","affected_versions":"apache-airflow>=2.2.0"}],"env_vars":null,"last_verified":"2026-05-12T16:32:50.943Z","next_check":"2026-06-26T00:00:00.000Z","problems":[{"fix":"pip install apache-airflow-providers-common-sql","cause":"The 'apache-airflow-providers-common-sql' package is not installed.","error":"ModuleNotFoundError: No module named 'airflow.providers.common.sql'"},{"fix":"Upgrade to a version where 'SQLExecuteQueryOperator' is available, e.g., 'pip install apache-airflow-providers-common-sql>=1.3.0'","cause":"The 'SQLExecuteQueryOperator' class is not available in the installed version of 'apache-airflow-providers-common-sql'.","error":"ImportError: cannot import name 'SQLExecuteQueryOperator' from 'airflow.providers.common.sql.operators.sql'"},{"fix":"Update the import statement to 'from airflow.hooks.dbapi import DbApiHook'","cause":"The 'DbApiHook' class has been moved or renamed in the 'apache-airflow-providers-common-sql' package.","error":"AttributeError: module 'airflow.providers.common.sql.hooks.sql' has no attribute 'DbApiHook'"},{"fix":"Ensure that the 'split_statements' parameter is set correctly, or upgrade to a version where this issue is resolved.","cause":"The 'SQLExecuteQueryOperator' is returning 'None' due to an issue with the 'split_statements' parameter.","error":"TypeError: 'NoneType' object is not iterable"},{"fix":"Upgrade to a version where 'SQLCheckOperator' is available, e.g., 'pip install apache-airflow-providers-common-sql>=1.1.0'","cause":"The 'SQLCheckOperator' class is not available in the installed version of 'apache-airflow-providers-common-sql'.","error":"ImportError: cannot import name 'SQLCheckOperator' from 'airflow.providers.common.sql.operators.sql'"}],"ecosystem":"pypi","meta_description":null,"install_score":85,"install_tag":"verified","quickstart_score":0,"quickstart_tag":"stale","pypi_latest":"1.36.0","install_checks":{"last_tested":"2026-05-12","tag":"verified","tag_description":"installs cleanly on critical runtimes, fast import, recently tested","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":4.47,"mem_mb":66.3,"disk_size":"244.0M"},{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":4.82,"mem_mb":76,"disk_size":"236.8M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":24.7,"import_time_s":3.39,"mem_mb":66.3,"disk_size":"242M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":3.65,"mem_mb":76,"disk_size":"235M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":5.59,"mem_mb":71.9,"disk_size":"263.9M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":6.8,"mem_mb":82.2,"disk_size":"256.0M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":23.6,"import_time_s":5.03,"mem_mb":71.9,"disk_size":"262M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":5.53,"mem_mb":82.2,"disk_size":"254M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":5.09,"mem_mb":70.6,"disk_size":"254.0M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":5.92,"mem_mb":79.9,"disk_size":"246.3M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":18.3,"import_time_s":5.32,"mem_mb":70.6,"disk_size":"253M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":5.95,"mem_mb":79.9,"disk_size":"245M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":4.8,"mem_mb":71.2,"disk_size":"255.9M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":5.56,"mem_mb":82.4,"disk_size":"248.1M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":18.6,"import_time_s":4.79,"mem_mb":71.2,"disk_size":"255M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":5.79,"mem_mb":82.4,"disk_size":"248M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"sdist","failure_reason":null,"install_time_s":null,"import_time_s":6.19,"mem_mb":80,"disk_size":"210.8M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":6.23,"mem_mb":80,"disk_size":"209.1M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":29.3,"import_time_s":6.18,"mem_mb":79.3,"disk_size":"206M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":6.03,"mem_mb":79.9,"disk_size":"204M"}]},"quickstart_checks":{"last_tested":"2026-04-23","tag":"stale","tag_description":"widespread failures or data too old to trust","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":1},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":1},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":1},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":1},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]}}