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/24 15:16:35 UTC

[GitHub] [airflow] alexandermalyga commented on a diff in pull request #25939: Fix insert placeholders in TrinoHook

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


##########
airflow/providers/trino/hooks/trino.py:
##########
@@ -251,3 +251,33 @@ def test_connection(self):
             message = str(e)
 
         return status, message
+
+    @staticmethod
+    def _generate_insert_sql(table, values, target_fields, replace, **kwargs):
+        """
+        Static helper method that generates the INSERT SQL statement.
+        The REPLACE variant is specific to MySQL syntax.
+
+        :param table: Name of the target table
+        :param values: The row to insert into the table
+        :param target_fields: The names of the columns to fill in the table
+        :param replace: Whether to replace instead of insert
+        :return: The generated INSERT or REPLACE SQL statement
+        :rtype: str
+        """
+        placeholders = [
+            "?",

Review Comment:
   We could add a `placeholder` parameter to `DbApiHook._generate_insert_sql()` function, which would be passed from `**kwargs` in `DbApiHook.insert_rows()`. The parameter could have a default value of "%s".



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