MCPcopy Create free account
hub / github.com/NanGePlus/LightRAGTest / query

Method query

LightRAG/lightrag/kg/oracle_impl.py:117–144  ·  view source on GitHub ↗
(
        self, sql: str, params: dict = None, multirows: bool = False
    )

Source from the content-addressed store, hash-verified

115 logger.info("Finished check all tables in Oracle database")
116
117 async def query(
118 self, sql: str, params: dict = None, multirows: bool = False
119 ) -> Union[dict, None]:
120 async with self.pool.acquire() as connection:
121 connection.inputtypehandler = self.input_type_handler
122 connection.outputtypehandler = self.output_type_handler
123 with connection.cursor() as cursor:
124 try:
125 await cursor.execute(sql, params)
126 except Exception as e:
127 logger.error(f"Oracle database error: {e}")
128 print(sql)
129 print(params)
130 raise
131 columns = [column[0].lower() for column in cursor.description]
132 if multirows:
133 rows = await cursor.fetchall()
134 if rows:
135 data = [dict(zip(columns, row)) for row in rows]
136 else:
137 data = []
138 else:
139 row = await cursor.fetchone()
140 if row:
141 data = dict(zip(columns, row))
142 else:
143 data = None
144 return data
145
146 async def execute(self, sql: str, data: list | dict = None):
147 # logger.info("go into OracleDB execute method")

Callers 14

check_tablesMethod · 0.95
get_by_idMethod · 0.45
get_by_idsMethod · 0.45
filter_keysMethod · 0.45
queryMethod · 0.45
has_nodeMethod · 0.45
has_edgeMethod · 0.45
node_degreeMethod · 0.45
get_nodeMethod · 0.45
get_edgeMethod · 0.45
get_node_edgesMethod · 0.45
get_all_nodesMethod · 0.45

Calls 1

executeMethod · 0.80

Tested by

no test coverage detected