MCPcopy Create free account
hub / github.com/apache/impala / __auto_closed_cursor

Function __auto_closed_cursor

tests/conftest.py:572–584  ·  view source on GitHub ↗

Returns a cursor created from conn. This is intended to be used in a "with" block. The cursor will be closed upon exiting the block.

(conn)

Source from the content-addressed store, hash-verified

570
571@contextlib.contextmanager
572def __auto_closed_cursor(conn):
573 """Returns a cursor created from conn. This is intended to be used in a "with" block.
574 The cursor will be closed upon exiting the block.
575 """
576 cursor = conn.cursor()
577 cursor.conn = conn
578 try:
579 yield cursor
580 finally:
581 try:
582 cursor.close()
583 except Exception as e:
584 LOG.warn("Error closing Impala cursor: %s", e)
585
586
587@pytest.fixture

Callers 2

__unique_connFunction · 0.85
cursorFunction · 0.85

Calls 3

warnMethod · 0.80
closeMethod · 0.65
cursorMethod · 0.45

Tested by

no test coverage detected