@@ -727,6 +727,26 @@ def test_execute_statement_calls_client_and_handle_execute_response(self, tcli_s
727727 # Check response handling
728728 thrift_backend ._handle_execute_response .assert_called_with (response , cursor_mock )
729729
730+ @patch ("databricks.sql.thrift_backend.TCLIService.Client" , autospec = True )
731+ def test_execute_statement_calls_client_and_handle_execute_response_with_parameters (self , tcli_service_class ):
732+ tcli_service_instance = tcli_service_class .return_value
733+ response = Mock ()
734+ tcli_service_instance .ExecuteStatement .return_value = response
735+ thrift_backend = ThriftBackend ("foobar" , 443 , "path" , [], auth_provider = AuthProvider ())
736+ thrift_backend ._handle_execute_response = Mock ()
737+ cursor_mock = Mock ()
738+
739+ thrift_backend .execute_command ("foo" , Mock (), 100 , 200 , Mock (), cursor_mock , {"param_name" : "param_value" })
740+ # Check call to client
741+ req = tcli_service_instance .ExecuteStatement .call_args [0 ][0 ]
742+ get_direct_results = ttypes .TSparkGetDirectResults (maxRows = 100 , maxBytes = 200 )
743+ self .assertEqual (req .getDirectResults , get_direct_results )
744+ spark_parameters = [ttypes .TSparkParameter (name = "param_name" , type = "STRING" , value = ttypes .TSparkParameterValue (stringValue = "param_value" ))]
745+ self .assertEqual (req .parameters , spark_parameters )
746+ self .assertEqual (req .statement , "foo" )
747+ # Check response handling
748+ thrift_backend ._handle_execute_response .assert_called_with (response , cursor_mock )
749+
730750 @patch ("databricks.sql.thrift_backend.TCLIService.Client" , autospec = True )
731751 def test_get_catalogs_calls_client_and_handle_execute_response (self , tcli_service_class ):
732752 tcli_service_instance = tcli_service_class .return_value
0 commit comments