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 15:36:06 UTC

[GitHub] [airflow] FanatoniQ opened a new pull request, #25185: 25092: MsSqlHook: fix for get_uri, adding pymssql driver to scheme

FanatoniQ opened a new pull request, #25185:
URL: https://github.com/apache/airflow/pull/25185

   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of an existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   Fixes #25092
   
   This PR fixes `get_uri` missing driver mention.
   The missing driver in the uri resulted in broken `get_sqlalchemy_engine` due to odbc being the default for mssql.
   
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [newsfragments](https://github.com/apache/airflow/tree/main/newsfragments).
   


-- 
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


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

Posted by GitBox <gi...@apache.org>.
FanatoniQ commented on code in PR #25185:
URL: https://github.com/apache/airflow/pull/25185#discussion_r933781297


##########
airflow/providers/microsoft/mssql/hooks/mssql.py:
##########
@@ -51,6 +51,13 @@ def get_conn(
         )
         return conn
 
+    def get_uri(self) -> str:
+        from urllib.parse import urlsplit, urlunsplit
+
+        r = list(urlsplit(super().get_uri()))
+        r[0] = "mssql+pymssql"  # fix to use pymssql driver
+        return urlunsplit(r)

Review Comment:
   > Still some pre-commits failed. I recommend (as in CONTRIBUTORS_GUIDE) to install pre-commit - it will fix most things automatically. Also `breeze static-check --last-commit` re-runs all relevant pre-commits for you automatically on last commit (so you need to rebase&squash to single commit before).
   
   Should be good now :smiley: 



##########
airflow/providers/microsoft/mssql/hooks/mssql.py:
##########
@@ -51,6 +51,13 @@ def get_conn(
         )
         return conn
 
+    def get_uri(self) -> str:
+        from urllib.parse import urlsplit, urlunsplit
+
+        r = list(urlsplit(super().get_uri()))
+        r[0] = "mssql+pymssql"  # fix to use pymssql driver
+        return urlunsplit(r)

Review Comment:
   > Still some pre-commits failed. I recommend (as in CONTRIBUTORS_GUIDE) to install pre-commit - it will fix most things automatically. Also `breeze static-check --last-commit` re-runs all relevant pre-commits for you automatically on last commit (so you need to rebase&squash to single commit before).
   
   Checks should be good now :smiley: 



-- 
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


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

Posted by GitBox <gi...@apache.org>.
potiuk commented on code in PR #25185:
URL: https://github.com/apache/airflow/pull/25185#discussion_r927104026


##########
airflow/providers/microsoft/mssql/hooks/mssql.py:
##########
@@ -51,6 +51,13 @@ def get_conn(
         )
         return conn
 
+    def get_uri(self) -> str:
+        from urllib.parse import urlsplit, urlunsplit
+
+        r = list(urlsplit(super().get_uri()))
+        r[0] = "mssql+pymssql"  # fix to use pymssql driver
+        return urlunsplit(r)

Review Comment:
   > By the way the docstring in odbc provider for sqlalchemy_scheme is copy pasted:
   
   Yep. Fixing it is a good idea - you can even do it in this PR or open another PR.



-- 
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


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

Posted by GitBox <gi...@apache.org>.
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 !
   
   Which 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


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

Posted by GitBox <gi...@apache.org>.
eladkal commented on code in PR #25185:
URL: https://github.com/apache/airflow/pull/25185#discussion_r926444996


##########
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:
   https://github.com/apache/airflow/pull/25214



-- 
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


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

Posted by GitBox <gi...@apache.org>.
FanatoniQ commented on code in PR #25185:
URL: https://github.com/apache/airflow/pull/25185#discussion_r926717328


##########
airflow/providers/microsoft/mssql/hooks/mssql.py:
##########
@@ -51,6 +51,13 @@ def get_conn(
         )
         return conn
 
+    def get_uri(self) -> str:
+        from urllib.parse import urlsplit, urlunsplit
+
+        r = list(urlsplit(super().get_uri()))
+        r[0] = "mssql+pymssql"  # fix to use pymssql driver
+        return urlunsplit(r)

Review Comment:
   @eladkal Done ;)



-- 
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


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

Posted by GitBox <gi...@apache.org>.
FanatoniQ commented on code in PR #25185:
URL: https://github.com/apache/airflow/pull/25185#discussion_r926528484


##########
airflow/providers/microsoft/mssql/hooks/mssql.py:
##########
@@ -51,6 +51,13 @@ def get_conn(
         )
         return conn
 
+    def get_uri(self) -> str:
+        from urllib.parse import urlsplit, urlunsplit
+
+        r = list(urlsplit(super().get_uri()))
+        r[0] = "mssql+pymssql"  # fix to use pymssql driver
+        return urlunsplit(r)

Review Comment:
   You are right, we could add a `DEFAULT_SQLALCHEMY_SCHEME = 'mssql+pymssql'` to the `MsSqlHook` class as well as a constructor parameter and use it.



-- 
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


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

Posted by GitBox <gi...@apache.org>.
FanatoniQ commented on code in PR #25185:
URL: https://github.com/apache/airflow/pull/25185#discussion_r926717874


##########
airflow/providers/microsoft/mssql/hooks/mssql.py:
##########
@@ -51,6 +51,13 @@ def get_conn(
         )
         return conn
 
+    def get_uri(self) -> str:
+        from urllib.parse import urlsplit, urlunsplit
+
+        r = list(urlsplit(super().get_uri()))
+        r[0] = "mssql+pymssql"  # fix to use pymssql driver
+        return urlunsplit(r)

Review Comment:
   By the way the docstring in odbc provider for `sqlalchemy_scheme` is copy pasted: 
   https://github.com/apache/airflow/blob/46bbfdade0638cb8a5d187e47034b84e68ddf762/airflow/providers/odbc/hooks/odbc.py#L84 



-- 
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


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

Posted by GitBox <gi...@apache.org>.
eladkal commented on code in PR #25185:
URL: https://github.com/apache/airflow/pull/25185#discussion_r926505349


##########
airflow/providers/microsoft/mssql/hooks/mssql.py:
##########
@@ -51,6 +51,13 @@ def get_conn(
         )
         return conn
 
+    def get_uri(self) -> str:
+        from urllib.parse import urlsplit, urlunsplit
+
+        r = list(urlsplit(super().get_uri()))
+        r[0] = "mssql+pymssql"  # fix to use pymssql driver
+        return urlunsplit(r)

Review Comment:
   Why?
   This is what we have in `OdbcHook`
   
   https://github.com/apache/airflow/blob/46bbfdade0638cb8a5d187e47034b84e68ddf762/airflow/providers/odbc/hooks/odbc.py#L34
   
   https://airflow.apache.org/docs/apache-airflow-providers-odbc/stable/connections/odbc.html#configuring-the-connection



-- 
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


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

Posted by GitBox <gi...@apache.org>.
FanatoniQ commented on code in PR #25185:
URL: https://github.com/apache/airflow/pull/25185#discussion_r926717328


##########
airflow/providers/microsoft/mssql/hooks/mssql.py:
##########
@@ -51,6 +51,13 @@ def get_conn(
         )
         return conn
 
+    def get_uri(self) -> str:
+        from urllib.parse import urlsplit, urlunsplit
+
+        r = list(urlsplit(super().get_uri()))
+        r[0] = "mssql+pymssql"  # fix to use pymssql driver
+        return urlunsplit(r)

Review Comment:
   @eladkal Done :smile: 



-- 
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


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

Posted by GitBox <gi...@apache.org>.
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


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

Posted by GitBox <gi...@apache.org>.
potiuk commented on code in PR #25185:
URL: https://github.com/apache/airflow/pull/25185#discussion_r927103463


##########
airflow/providers/microsoft/mssql/hooks/mssql.py:
##########
@@ -51,6 +51,13 @@ def get_conn(
         )
         return conn
 
+    def get_uri(self) -> str:
+        from urllib.parse import urlsplit, urlunsplit
+
+        r = list(urlsplit(super().get_uri()))
+        r[0] = "mssql+pymssql"  # fix to use pymssql driver
+        return urlunsplit(r)

Review Comment:
   Still some pre-commits failed. I recommend (as in CONTRIBUTORS_GUIDE) to install pre-commit - it will fix most things automatically. Also `breeze static-check --last-commit` re-runs all relevant pre-commits for you automatically on last commit (so you need to rebase&squash to single commit before).



-- 
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


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

Posted by GitBox <gi...@apache.org>.
eladkal commented on code in PR #25185:
URL: https://github.com/apache/airflow/pull/25185#discussion_r926507058


##########
airflow/providers/microsoft/mssql/hooks/mssql.py:
##########
@@ -51,6 +51,13 @@ def get_conn(
         )
         return conn
 
+    def get_uri(self) -> str:
+        from urllib.parse import urlsplit, urlunsplit
+
+        r = list(urlsplit(super().get_uri()))
+        r[0] = "mssql+pymssql"  # fix to use pymssql driver
+        return urlunsplit(r)

Review Comment:
   Is this the right way?
   This is what we have in OdbcHook
   https://github.com/apache/airflow/blob/46bbfdade0638cb8a5d187e47034b84e68ddf762/airflow/providers/odbc/hooks/odbc.py#L34
   
   and users can override this
   https://airflow.apache.org/docs/apache-airflow-providers-odbc/stable/connections/odbc.html#configuring-the-connection



-- 
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


[GitHub] [airflow] ultrabug commented on pull request #25185: Fix MsSqlHook get_uri, adding pymssql driver to scheme (25092)

Posted by GitBox <gi...@apache.org>.
ultrabug commented on PR #25185:
URL: https://github.com/apache/airflow/pull/25185#issuecomment-1207760947

   Congratulations @FanatoniQ ! and thanks @potiuk 


-- 
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


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

Posted by GitBox <gi...@apache.org>.
FanatoniQ commented on code in PR #25185:
URL: https://github.com/apache/airflow/pull/25185#discussion_r926747681


##########
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:
   I rebased and removed mine as well @eladkal 



-- 
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


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

Posted by GitBox <gi...@apache.org>.
FanatoniQ commented on code in PR #25185:
URL: https://github.com/apache/airflow/pull/25185#discussion_r933781195


##########
airflow/providers/microsoft/mssql/hooks/mssql.py:
##########
@@ -51,6 +51,13 @@ def get_conn(
         )
         return conn
 
+    def get_uri(self) -> str:
+        from urllib.parse import urlsplit, urlunsplit
+
+        r = list(urlsplit(super().get_uri()))
+        r[0] = "mssql+pymssql"  # fix to use pymssql driver
+        return urlunsplit(r)

Review Comment:
   > > By the way the docstring in odbc provider for sqlalchemy_scheme is copy pasted:
   > 
   > Yep. Fixing it is a good idea - you can even do it in this PR or open another PR.
   
   I made another PR for odbc docstring fix: #25421 :wink: 



##########
airflow/providers/microsoft/mssql/hooks/mssql.py:
##########
@@ -51,6 +51,13 @@ def get_conn(
         )
         return conn
 
+    def get_uri(self) -> str:
+        from urllib.parse import urlsplit, urlunsplit
+
+        r = list(urlsplit(super().get_uri()))
+        r[0] = "mssql+pymssql"  # fix to use pymssql driver
+        return urlunsplit(r)

Review Comment:
   > > By the way the docstring in odbc provider for sqlalchemy_scheme is copy pasted:
   > 
   > Yep. Fixing it is a good idea - you can even do it in this PR or open another PR.
   
   I made another PR for odbc docstring fix: #25421 :wink: @potiuk 



-- 
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


[GitHub] [airflow] potiuk merged pull request #25185: Fix MsSqlHook get_uri, adding pymssql driver to scheme (25092)

Posted by GitBox <gi...@apache.org>.
potiuk merged PR #25185:
URL: https://github.com/apache/airflow/pull/25185


-- 
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


[GitHub] [airflow] boring-cyborg[bot] commented on pull request #25185: 25092: MsSqlHook: fix for get_uri, adding pymssql driver to scheme

Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on PR #25185:
URL: https://github.com/apache/airflow/pull/25185#issuecomment-1190439185

   Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
   Here are some useful points:
   - Pay attention to the quality of your code (flake8, mypy and type annotations). Our [pre-commits]( https://github.com/apache/airflow/blob/main/STATIC_CODE_CHECKS.rst#prerequisites-for-pre-commit-hooks) will help you with that.
   - In case of a new feature add useful documentation (in docstrings or in `docs/` directory). Adding a new operator? Check this short [guide](https://github.com/apache/airflow/blob/main/docs/apache-airflow/howto/custom-operator.rst) Consider adding an example DAG that shows how users should use it.
   - Consider using [Breeze environment](https://github.com/apache/airflow/blob/main/BREEZE.rst) for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
   - Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
   - Please follow [ASF Code of Conduct](https://www.apache.org/foundation/policies/conduct) for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
   - Be sure to read the [Airflow Coding style]( https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#coding-style-and-best-practices).
   Apache Airflow is a community-driven project and together we are making it better 🚀.
   In case of doubts contact the developers at:
   Mailing List: dev@airflow.apache.org
   Slack: https://s.apache.org/airflow-slack
   


-- 
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


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

Posted by GitBox <gi...@apache.org>.
eladkal commented on code in PR #25185:
URL: https://github.com/apache/airflow/pull/25185#discussion_r925813904


##########
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:
   Is this right?
   https://github.com/pymssql/pymssql/pull/659



-- 
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


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

Posted by GitBox <gi...@apache.org>.
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 !
   
   We currently have 2.2.5 as 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