File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
tests/integration_tests/db_engine_specs Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -1268,11 +1268,11 @@ def get_create_view(
12681268 sql = f"SHOW CREATE VIEW { schema } .{ table } "
12691269 try :
12701270 cls .execute (cursor , sql )
1271+ rows = cls .fetch_data (cursor , 1 )
1272+
1273+ return rows [0 ][0 ]
12711274 except DatabaseError : # not a VIEW
12721275 return None
1273- rows = cls .fetch_data (cursor , 1 )
1274-
1275- return rows [0 ][0 ]
12761276
12771277 @classmethod
12781278 def get_tracking_url (cls , cursor : Cursor ) -> str | None :
Original file line number Diff line number Diff line change @@ -925,9 +925,11 @@ def test_get_create_view_exception(self):
925925 def test_get_create_view_database_error (self ):
926926 from pyhive .exc import DatabaseError
927927
928- mock_execute = mock .MagicMock (side_effect = DatabaseError ())
928+ mock_execute = mock .MagicMock ()
929+ mock_fetch_data = mock .MagicMock (side_effect = DatabaseError ())
929930 database = mock .MagicMock ()
930931 database .get_raw_connection ().__enter__ ().cursor ().execute = mock_execute
932+ database .get_raw_connection ().__enter__ ().cursor ().fetchall = mock_fetch_data
931933 schema = "schema"
932934 table = "table"
933935 result = PrestoEngineSpec .get_create_view (database , schema = schema , table = table )
You can’t perform that action at this time.
0 commit comments