From bef02a312f94a13ce4b71afe05b5217eab518a4b Mon Sep 17 00:00:00 2001 From: David Blain Date: Fri, 19 Jul 2024 10:22:46 +0200 Subject: [PATCH] docs: Updated docstring of JdbcHook and mentioned importance of sqlalchemy_scheme parameter --- airflow/providers/jdbc/hooks/jdbc.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/airflow/providers/jdbc/hooks/jdbc.py b/airflow/providers/jdbc/hooks/jdbc.py index e0de36f7f1df5..81c63cbe3da16 100644 --- a/airflow/providers/jdbc/hooks/jdbc.py +++ b/airflow/providers/jdbc/hooks/jdbc.py @@ -62,7 +62,12 @@ class JdbcHook(DbApiHook): "providers.jdbc" section of the Airflow configuration. If you're enabling these options in Airflow configuration, you should make sure that you trust the users who can edit connections in the UI to not use it maliciously. - 4. Patch the ``JdbcHook.default_driver_path`` and/or ``JdbcHook.default_driver_class`` values in the + 4. Define the "sqlalchemy_scheme" property in the extra of the connection if you want to use the + SQLAlchemy engine from the JdbcHook. When using the JdbcHook, the "sqlalchemy_scheme" will by + default have the "jdbc" value, which is a protocol, not a database scheme or dialect. So in order + to be able to use SQLAlchemy with the JdbcHook, you need to define the "sqlalchemy_scheme" + property in the extra of the connection. + 5. Patch the ``JdbcHook.default_driver_path`` and/or ``JdbcHook.default_driver_class`` values in the ``local_settings.py`` file. See :doc:`/connections/jdbc` for full documentation.