@@ -294,22 +294,13 @@ def warnings(self):
294
294
return self ._query .warnings
295
295
return None
296
296
297
- def _new_request_with_session_from (self , request ):
298
- """
299
- Returns a new request with the `ClientSession` set to the one from the
300
- given request.
301
- """
302
- request = self .connection ._create_request ()
303
- request ._client_session = request ._client_session
304
- return request
305
-
306
297
def setinputsizes (self , sizes ):
307
298
raise trino .exceptions .NotSupportedError
308
299
309
300
def setoutputsize (self , size , column ):
310
301
raise trino .exceptions .NotSupportedError
311
302
312
- def _prepare_statement (self , statement , name ) :
303
+ def _prepare_statement (self , statement : str , name : str ) -> None :
313
304
"""
314
305
Registers a prepared statement for the provided `operation` with the
315
306
`name` assigned to it.
@@ -318,8 +309,7 @@ def _prepare_statement(self, statement, name):
318
309
:param name: name that will be assigned to the prepared statement.
319
310
"""
320
311
sql = f"PREPARE { name } FROM { statement } "
321
- # TODO: Evaluate whether we can avoid the piggybacking on current request
322
- query = trino .client .TrinoQuery (self ._new_request_with_session_from (self ._request ), sql = sql ,
312
+ query = trino .client .TrinoQuery (self .connection ._create_request (), sql = sql ,
323
313
experimental_python_types = self ._experimental_pyton_types )
324
314
query .execute ()
325
315
@@ -404,10 +394,9 @@ def _format_prepared_param(self, param):
404
394
405
395
raise trino .exceptions .NotSupportedError ("Query parameter of type '%s' is not supported." % type (param ))
406
396
407
- def _deallocate_prepared_statement (self , statement_name ) :
397
+ def _deallocate_prepared_statement (self , statement_name : str ) -> None :
408
398
sql = 'DEALLOCATE PREPARE ' + statement_name
409
- # TODO: Evaluate whether we can avoid the piggybacking on current request
410
- query = trino .client .TrinoQuery (self ._new_request_with_session_from (self ._request ), sql = sql ,
399
+ query = trino .client .TrinoQuery (self .connection ._create_request (), sql = sql ,
411
400
experimental_python_types = self ._experimental_pyton_types )
412
401
query .execute ()
413
402
0 commit comments