forked from chdb-io/chdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdbapi.py
More file actions
34 lines (30 loc) 路 784 Bytes
/
Copy pathdbapi.py
File metadata and controls
34 lines (30 loc) 路 784 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python
from chdb import dbapi
from chdb.dbapi.cursors import DictCursor
print("chdb driver version: {0}".format(dbapi.get_client_info()))
conn1 = dbapi.connect()
cur1 = conn1.cursor()
cur1.execute('select version()')
print("description: ", cur1.description)
print("data: ", cur1.fetchone())
cur1.close()
conn1.close()
# conn2 = dbapi.connect(cursorclass=DictCursor)
# cur2 = conn2.cursor()
# cur2.execute('''
# SELECT
# town,
# district,
# count() AS c,
# round(avg(price)) AS price
# FROM url('https://datasets-documentation.s3.eu-west-3.amazonaws.com/house_parquet/house_0.parquet')
# GROUP BY
# town,
# district
# LIMIT 10
# ''')
# print("description", cur2.description)
# for row in cur2:
# print(row)
# cur2.close()
# conn2.close()