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/08/26 13:11:00 UTC

[GitHub] [airflow] Taragolis commented on a diff in pull request #25939: Fix placeholders in `TrinoHook`, `PrestoHook`, `SqliteHook`

Taragolis commented on code in PR #25939:
URL: https://github.com/apache/airflow/pull/25939#discussion_r956027518


##########
airflow/providers/common/sql/hooks/sql.py:
##########
@@ -109,6 +109,8 @@ class DbApiHook(BaseForDbApiHook):
     connector = None  # type: Optional[ConnectorProtocol]
     # Override with db-specific query to check connection
     _test_connection_sql = "select 1"
+    # Override with the db-specific value used for placeholders
+    placeholder: str = "%s"

Review Comment:
   Is it reference to [mandatory DB-API 2 paramstyle property](https://peps.python.org/pep-0249/#paramstyle)? 
   
   
   ```python
   Python 3.9.10 (main, Feb 25 2022, 16:54:01) 
   Type 'copyright', 'credits' or 'license' for more information
   IPython 8.4.0 -- An enhanced Interactive Python. Type '?' for help.
   PyDev console: using IPython 8.4.0
   Python 3.9.10 (main, Feb 25 2022, 16:54:01) 
   [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
   
   import sqlite3, trino, prestodb, psycopg2
   sqlite3.paramstyle
   Out[3]: 'qmark'
   trino.dbapi.paramstyle
   Out[4]: 'qmark'
   psycopg2.paramstyle
   Out[5]: 'pyformat'
   prestodb.dbapi.paramstyle
   Traceback (most recent call last):
     File "/Users/taragolis/.pyenv/versions/airflow-dev-env-39/lib/python3.9/site-packages/IPython/core/interactiveshell.py", line 3398, in run_code
       exec(code_obj, self.user_global_ns, self.user_ns)
     File "<ipython-input-6-cb48c8aec499>", line 1, in <cell line: 1>
       prestodb.dbapi.paramstyle
   AttributeError: module 'prestodb.dbapi' has no attribute 'paramstyle'
   ```



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