Skip to content

Commit

Permalink
Enable semicolon stripping for PrestoHook (#34828)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Astankov committed Aug 31, 2024
1 parent 0e97fa8 commit 06278ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions airflow/providers/presto/hooks/presto.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class PrestoHook(DbApiHook):
default_conn_name = "presto_default"
conn_type = "presto"
hook_name = "Presto"
strip_semicolon = True

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
Expand Down
7 changes: 7 additions & 0 deletions tests/providers/presto/hooks/test_presto.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,13 @@ def test_get_pandas_df(self):

self.cur.execute.assert_called_once_with(statement, None)

def test_split_sql_string(self):
statement = "SELECT 1; SELECT 2"
result_sets = ["SELECT 1", "SELECT 2"]
self.cur.fetchall.return_value = result_sets

assert result_sets == self.db_hook.split_sql_string(statement)

def test_serialize_cell(self):
assert "foo" == self.db_hook._serialize_cell("foo", None)
assert 1 == self.db_hook._serialize_cell(1, None)

0 comments on commit 06278ce

Please sign in to comment.