Beispiel #1
0
        def cursor(self, *args, **kwargs):
            # Only one cursor per connection is allowed, as per DB API spec
            self.close_cursor()
            self._last_usage = self._loop.time()

            coro = self._cursor(*args, **kwargs)
            return _ContextManager(coro)
 def wrap_connect_(
     wrapped: typing.Callable[..., typing.Any],
     instance: typing.Any,
     args: typing.Tuple[typing.Any, typing.Any],
     kwargs: typing.Dict[typing.Any, typing.Any],
 ):
     db_integration = AiopgIntegration(
         name,
         database_system,
         connection_attributes=connection_attributes,
         version=version,
         tracer_provider=tracer_provider,
     )
     return _ContextManager(  # pylint: disable=no-value-for-parameter
         db_integration.wrapped_connection(wrapped, args, kwargs))
 def wrap_connect_(
     wrapped: typing.Callable[..., typing.Any],
     instance: typing.Any,
     args: typing.Tuple[typing.Any, typing.Any],
     kwargs: typing.Dict[typing.Any, typing.Any],
 ):
     db_integration = AiopgIntegration(
         name,
         database_component,
         database_type=database_type,
         connection_attributes=connection_attributes,
         version=version,
         tracer_provider=tracer_provider,
     )
     return _ContextManager(
         db_integration.wrapped_connection(wrapped, args, kwargs))
Beispiel #4
0
 def cursor(self, *args, **kwargs):
     # unfortunately we also need to patch this method as otherwise "self"
     # ends up being the aiopg connection object
     coro = self._cursor(*args, **kwargs)
     return _ContextManager(coro)
Beispiel #5
0
 def cursor(self):
     coro = self._cursor()
     return _ContextManager(coro)
Beispiel #6
0
 def cursor(self, *args, **kwargs):
     # unfortunately we also need to patch this method as otherwise "self"
     # ends up being the aiopg connection object
     coro = self._cursor(*args, **kwargs)
     return _ContextManager(coro)
Beispiel #7
0
 def cursor(self, *args, **kwargs):
     coro = self._cursor(*args, **kwargs)
     return _ContextManager(coro)
 def cursor(self):
     coro = self._cursor()
     return _ContextManager(coro)  # pylint: disable=no-value-for-parameter