MCPcopy Create free account
hub / github.com/OpenBMB/BMTools / execute_sql

Function execute_sql

bmtools/tools/database/data/script.py:11–27  ·  view source on GitHub ↗
(sql)

Source from the content-addressed store, hash-verified

9prepare the test samples
10'''
11def execute_sql(sql):
12 conn = psycopg2.connect(database='tpch10x',
13 user='xxx',
14 password='xxx',
15 host='xxx',
16 port=xxx)
17
18 cur = conn.cursor()
19 cur.execute(sql)
20 # res = cur.fetchall()[0][0][0]
21 res = cur.fetchall()
22
23 conn.commit()
24 cur.close()
25 conn.close()
26
27 return len(res)
28
29# Load the JSON file as a dictionary
30data = {}

Callers 1

script.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected