MCPcopy Create free account
hub / github.com/CloudOrc/SolidUI / run_query

Method run_query

solidui/datasource_plugin/base.py:113–122  ·  view source on GitHub ↗
(self, sql)

Source from the content-addressed store, hash-verified

111 return [table[0] for table in cursor]
112
113 def run_query(self, sql):
114 cursor = self.conn.cursor()
115 cursor.execute(sql)
116 column_names = [col[0] for col in cursor.description]
117 rows = [column_names] # First row is column names
118
119 for row in cursor.fetchall():
120 rows.append([str(col) if col is not None else None for col in row])
121
122 return rows
123
124 def generate_select_all_data_sql(self, database, table_name):
125 return f"SELECT * FROM {database}.{table_name}"

Callers 4

get_table_dataMethod · 0.45
query_sqlMethod · 0.45
query_sql_by_idMethod · 0.45
queryMethod · 0.45

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected