This is an automated email from the ASF dual-hosted git repository.

jscheffl pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 3e8449fbcfa Fix rowcount logging in exasol provider (#44022) (#45760)
3e8449fbcfa is described below

commit 3e8449fbcfa97c267b58447d1eb72b17c5fda76b
Author: Benjamin Laumann <[email protected]>
AuthorDate: Sat Jan 18 17:40:19 2025 +0100

    Fix rowcount logging in exasol provider (#44022) (#45760)
---
 providers/src/airflow/providers/exasol/hooks/exasol.py | 2 +-
 providers/tests/exasol/hooks/test_exasol.py            | 2 +-
 providers/tests/exasol/hooks/test_sql.py               | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/providers/src/airflow/providers/exasol/hooks/exasol.py 
b/providers/src/airflow/providers/exasol/hooks/exasol.py
index ad3362e9115..69c51ab4c8e 100644
--- a/providers/src/airflow/providers/exasol/hooks/exasol.py
+++ b/providers/src/airflow/providers/exasol/hooks/exasol.py
@@ -246,7 +246,7 @@ class ExasolHook(DbApiHook):
                         else:
                             results.append(result)
                             
self.descriptions.append(self.get_description(exa_statement))
-                    self.log.info("Rows affected: %s", exa_statement.rowcount)
+                    self.log.info("Rows affected: %s", 
exa_statement.rowcount())
 
             # If autocommit was set to False or db does not support 
autocommit, we do a manual commit.
             if not self.get_autocommit(conn):
diff --git a/providers/tests/exasol/hooks/test_exasol.py 
b/providers/tests/exasol/hooks/test_exasol.py
index 1c58431ea69..9882622aef5 100644
--- a/providers/tests/exasol/hooks/test_exasol.py
+++ b/providers/tests/exasol/hooks/test_exasol.py
@@ -65,7 +65,7 @@ class TestExasolHookConn:
 
 class TestExasolHook:
     def setup_method(self):
-        self.cur = mock.MagicMock(rowcount=0)
+        self.cur = mock.MagicMock(rowcount=lambda: 0)
         self.conn = mock.MagicMock()
         self.conn.execute.return_value = self.cur
         conn = self.conn
diff --git a/providers/tests/exasol/hooks/test_sql.py 
b/providers/tests/exasol/hooks/test_sql.py
index 4864c837902..4e57ebe4b61 100644
--- a/providers/tests/exasol/hooks/test_sql.py
+++ b/providers/tests/exasol/hooks/test_sql.py
@@ -260,7 +260,7 @@ def test_query(
         cursors = []
         for index in range(len(cursor_descriptions)):
             cur = mock.MagicMock(
-                rowcount=len(cursor_results[index]),
+                rowcount=lambda: len(cursor_results[index]),
             )
             cur.columns.return_value = get_columns(cursor_descriptions[index])
             cur.fetchall.return_value = cursor_results[index]
@@ -287,7 +287,7 @@ def test_query(
 )
 def test_no_query(empty_statement):
     dbapi_hook = ExasolHookForTests()
-    dbapi_hook.get_conn.return_value.cursor.rowcount = 0
+    dbapi_hook.get_conn.return_value.cursor.rowcount = lambda: 0
     with pytest.raises(ValueError) as err:
         dbapi_hook.run(sql=empty_statement)
     assert err.value.args[0] == "List of SQL statements is empty"

Reply via email to