#NEWLINE# def cursor( self , user = None , configuration = None , convert_types = True , dictify = False ) : #NEWLINE# #INDENT# 'Get a cursor from the HiveServer2 (HS2) connection.\n\n        Parameters\n        ----------\n        user : str, optional\n        configuration : dict of str keys and values, optional\n            Configuration overlay for the HS2 session.\n        convert_types : bool, optional\n            When `False`, timestamps and decimal values will not be converted\n            to Python `datetime` and `Decimal` values. (These conversions are\n            expensive.)\n\n        Returns\n        -------\n        HiveServer2Cursor\n            A `Cursor` object (DB API 2.0-compliant).\n        ' #NEWLINE# log . debug ( 'Getting a cursor (Impala session)' ) #NEWLINE# if ( user is None ) : #NEWLINE# #INDENT# user = getpass . getuser ( ) #NEWLINE# #UNINDENT# log . debug ( '.cursor(): getting new session_handle' ) #NEWLINE# session = self . service . open_session ( user , configuration ) #NEWLINE# log . debug ( 'HiveServer2Cursor(service=%s, session_handle=%s, default_config=%s, hs2_protocol_version=%s)' , self . service , session . handle , session . config , session . hs2_protocol_version ) #NEWLINE# cursor_class = ( HiveServer2DictCursor if dictify else HiveServer2Cursor ) #NEWLINE# cursor = cursor_class ( session , convert_types = convert_types ) #NEWLINE# if ( self . default_db is not None ) : #NEWLINE# #INDENT# log . info ( 'Using database %s as default' , self . default_db ) #NEWLINE# cursor . execute ( ( 'USE %s' % self . default_db ) ) #NEWLINE# #UNINDENT# return cursor