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 2020/12/03 08:23:08 UTC

[GitHub] [airflow] alokshenoy opened a new pull request #12775: BugFix: Adds support for special characters in DbApiHook

alokshenoy opened a new pull request #12775:
URL: https://github.com/apache/airflow/pull/12775


   Closes [#12722](https://github.com/apache/airflow/issues/12722) raised by @NadimYounes
   
   - Uses urllib.parse.quote_plus to urlencode the password since SQLAlchemy requires a valid URI to create an engine.
   
   - Adds test case that checks for encoding of password.
   


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

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



[GitHub] [airflow] ashb commented on a change in pull request #12775: BugFix: Adds support for special characters in DbApiHook

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #12775:
URL: https://github.com/apache/airflow/pull/12775#discussion_r535090924



##########
File path: airflow/hooks/dbapi_hook.py
##########
@@ -78,7 +79,7 @@ def get_uri(self) -> str:
         conn = self.get_connection(getattr(self, self.conn_name_attr))
         login = ''
         if conn.login:
-            login = '{conn.login}:{conn.password}@'.format(conn=conn)
+            login = '{conn.login}:{quote_plus(conn.password)}@'.format(conn=conn)

Review comment:
       It does -- hosted Postgresql service on Azure has an `@` in the username.




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

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



[GitHub] [airflow] github-actions[bot] commented on pull request #12775: BugFix: Adds support for special characters in DbApiHook

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #12775:
URL: https://github.com/apache/airflow/pull/12775#issuecomment-737857638


   [The Workflow run](https://github.com/apache/airflow/actions/runs/398158018) is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*.


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

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



[GitHub] [airflow] potiuk commented on pull request #12775: BugFix: Adds support for special characters in DbApiHook

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #12775:
URL: https://github.com/apache/airflow/pull/12775#issuecomment-739812382


   @mik-laj - does it look good for you as well ? I would like to merge it, but need a second pair of eyes :)


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

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



[GitHub] [airflow] mik-laj commented on a change in pull request #12775: BugFix: Adds support for special characters in DbApiHook

Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #12775:
URL: https://github.com/apache/airflow/pull/12775#discussion_r534906197



##########
File path: airflow/hooks/dbapi_hook.py
##########
@@ -78,7 +79,7 @@ def get_uri(self) -> str:
         conn = self.get_connection(getattr(self, self.conn_name_attr))
         login = ''
         if conn.login:
-            login = '{conn.login}:{conn.password}@'.format(conn=conn)
+            login = '{conn.login}:{quote_plus(conn.password)}@'.format(conn=conn)

Review comment:
       Does this problem also apply to the login?




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

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



[GitHub] [airflow] github-actions[bot] commented on pull request #12775: BugFix: Adds support for special characters in DbApiHook

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #12775:
URL: https://github.com/apache/airflow/pull/12775#issuecomment-739835794


   The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest master at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.


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

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



[GitHub] [airflow] mik-laj merged pull request #12775: BugFix: Adds support for special characters in DbApiHook

Posted by GitBox <gi...@apache.org>.
mik-laj merged pull request #12775:
URL: https://github.com/apache/airflow/pull/12775


   


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

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



[GitHub] [airflow] alokshenoy commented on a change in pull request #12775: BugFix: Adds support for special characters in DbApiHook

Posted by GitBox <gi...@apache.org>.
alokshenoy commented on a change in pull request #12775:
URL: https://github.com/apache/airflow/pull/12775#discussion_r534941250



##########
File path: airflow/hooks/dbapi_hook.py
##########
@@ -78,7 +79,7 @@ def get_uri(self) -> str:
         conn = self.get_connection(getattr(self, self.conn_name_attr))
         login = ''
         if conn.login:
-            login = '{conn.login}:{conn.password}@'.format(conn=conn)
+            login = '{conn.login}:{quote_plus(conn.password)}@'.format(conn=conn)

Review comment:
       Good point. It could. To be safe, we should apply the same to login too. 




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

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



[GitHub] [airflow] alokshenoy commented on pull request #12775: BugFix: Adds support for special characters in DbApiHook

Posted by GitBox <gi...@apache.org>.
alokshenoy commented on pull request #12775:
URL: https://github.com/apache/airflow/pull/12775#issuecomment-738619219


   @NadimYounes , @ashb - This is ready to be reviewed.


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

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



[GitHub] [airflow] alokshenoy commented on pull request #12775: BugFix: Adds support for special characters in DbApiHook

Posted by GitBox <gi...@apache.org>.
alokshenoy commented on pull request #12775:
URL: https://github.com/apache/airflow/pull/12775#issuecomment-738188831


   Looking into the static check failure. 


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

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



[GitHub] [airflow] github-actions[bot] commented on pull request #12775: BugFix: Adds support for special characters in DbApiHook

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #12775:
URL: https://github.com/apache/airflow/pull/12775#issuecomment-738191228


   [The Workflow run](https://github.com/apache/airflow/actions/runs/398890241) is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*.


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

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



[GitHub] [airflow] ashb commented on a change in pull request #12775: BugFix: Adds support for special characters in DbApiHook

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #12775:
URL: https://github.com/apache/airflow/pull/12775#discussion_r535090476



##########
File path: airflow/hooks/dbapi_hook.py
##########
@@ -78,7 +79,7 @@ def get_uri(self) -> str:
         conn = self.get_connection(getattr(self, self.conn_name_attr))
         login = ''
         if conn.login:
-            login = '{conn.login}:{conn.password}@'.format(conn=conn)
+            login = '{quote_plus(conn.login)}:{quote_plus(conn.password)}@'.format(conn=conn)

Review comment:
       This isn't an f-string, so you can't use quote_plus like this.
   
   ```suggestion
               login = '{login}:{pass}@'.format(login=quote_plus(conn.login), pass=quote_plus(conn.password))
   ```
   
   or
   
   ```suggestion
               login = f'{quote_plus(conn.login)}:{quote_plus(conn.password)}@'
   ```




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

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