presto-python-client icon indicating copy to clipboard operation
presto-python-client copied to clipboard

How can I get col_names?

Open hai1y1kr opened this issue 2 years ago • 2 comments

cursor.description return None

hai1y1kr avatar Apr 15 '22 03:04 hai1y1kr

What's your query? My returns correctly in cursor.description

anikolaienko avatar Aug 24 '22 20:08 anikolaienko

What's your query? My returns correctly in cursor.description This is my function,and all the cursor.description is None for different querys. def read_table(self, sql_sentence= r'show tables'): if self.is_connected(): logger.debug('='*40) logger.debug('Executing: ' + sql_sentence) start_time = time.time() try: if self.plantform == 'presto': sentence_1 = 'set session hive.parquet_fail_with_corrupted_statistics = false' self.cursor.execute(sentence_1) self.cursor.fetchall() self.cursor.execute(sql_sentence) self.con.commit() col_names = self.cursor.description rows = self.cursor.fetchall() logger.info('Got rows: ' + str(len(rows)) + ' time consumed: ' + str(time.time() - start_time)) except Exception as e: logger.error('read table failed: ' + str(e)) return rows, col_names else: logger.warn('warning: disconnected')

hai1y1kr avatar Aug 25 '22 02:08 hai1y1kr