@@ -298,15 +298,6 @@ def execute_sql(self, *args, **kwargs):
298
298
(str (args ), str (kwargs )))
299
299
return super ().execute_sql (* args , ** kwargs )
300
300
301
- async def fetch_results (self , query , cursor ):
302
- # TODO: Probably we don't need this method at all?
303
- # We might get here if we use older `Manager` interface.
304
- if isinstance (query , peewee .BaseModelSelect ):
305
- return await AsyncQueryWrapper .make_for_all_rows (cursor , query )
306
- if isinstance (query , peewee .RawQuery ):
307
- return await AsyncQueryWrapper .make_for_all_rows (cursor , query )
308
- assert False , "Unsupported type of query '%s', use AioModel instead" % type (query )
309
-
310
301
def connection (self ) -> ConnectionContext :
311
302
return ConnectionContext (self .aio_pool , self ._task_data )
312
303
@@ -324,16 +315,12 @@ async def aio_execute(self, query, fetch_results=None):
324
315
325
316
:param query: peewee query instance created with ``Model.select()``,
326
317
``Model.update()`` etc.
327
- :param fetch_results: function with cursor param. It let you get data manually and don't need to close cursor
328
- It will be closed automatically
329
- :return: result depends on query type, it's the same as for sync
330
- ``query.execute()``
318
+ :param fetch_results: function with cursor param. It let you get data manually and
319
+ don't need to close cursor It will be closed automatically.
320
+ :return: result depends on query type, it's the same as for sync `query.execute()`
331
321
"""
332
322
sql , params = query .sql ()
333
- if fetch_results is None :
334
- query_fetch_results = getattr (query , 'fetch_results' , None )
335
- database_fetch_results = functools .partial (self .fetch_results , query )
336
- fetch_results = query_fetch_results or database_fetch_results
323
+ fetch_results = fetch_results or getattr (query , 'fetch_results' , None )
337
324
return await self .aio_execute_sql (sql , params , fetch_results = fetch_results )
338
325
339
326
0 commit comments