You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/07/20 16:48:46 UTC

[GitHub] [airflow] FanatoniQ commented on a diff in pull request #25185: 25092: MsSqlHook: fix for get_uri, adding pymssql driver to scheme

FanatoniQ commented on code in PR #25185:
URL: https://github.com/apache/airflow/pull/25185#discussion_r925839578


##########
tests/providers/microsoft/mssql/hooks/test_mssql.py:
##########
@@ -70,3 +70,27 @@ def test_get_autocommit_should_return_autocommit_state(self, get_connection, mss
 
         mssql_get_conn.assert_called_once()
         assert hook.get_autocommit(conn) == 'autocommit_state'
+
+    @mock.patch('airflow.providers.microsoft.mssql.hooks.mssql.MsSqlHook.get_conn')
+    def test_get_uri_driver_rewrite(self, mock_get_conn):
+        mock_get_conn.return_value = PYMSSQL_CONN
+
+        hook = MsSqlHook()
+        res_uri = hook.get_uri()
+
+        mock_get_conn.assert_called_once()
+        assert res_uri == (
+            "mssql+pymssql://"
+            f"{PYMSSQL_CONN.login}:{PYMSSQL_CONN.password}"
+            f"@{PYMSSQL_CONN.host}:{PYMSSQL_CONN.port}/{PYMSSQL_CONN.schema}"
+        )
+
+    @unittest.skipIf(PY38, "Mssql package not available when Python >= 3.8.")

Review Comment:
   You are right, version 2.1.5 added support for Python 3.8 !
   
   https://github.com/pymssql/pymssql/releases/tag/v2.1.5
   
   This is the version listed in airflow constraints file https://raw.githubusercontent.com/apache/airflow/constraints-2.3.3/constraints-3.8.txt
   
   We should remove the decorator for the other tests as well.
   



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org