Skip to content

Commit 80671ab

Browse files
committed
fix: connection.close()
1 parent 8c4da88 commit 80671ab

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

databend_sqlalchemy/connector.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def __init__(self, db_url='http://root:@localhost:8081'):
102102
self.client = Client.from_url(db_url)
103103

104104
def close(self):
105-
pass
105+
self.client.disconnect()
106106

107107
def commit(self):
108108
pass
@@ -166,7 +166,7 @@ def description(self):
166166
return self._columns
167167

168168
def close(self):
169-
pass
169+
self._reset_state()
170170

171171
def execute(self, operation, parameters=None, is_response=True):
172172
"""Prepare and execute a database operation (query or command). """

databend_sqlalchemy/test.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33

44
def test():
5-
cursor = connector.connect('http://root:@localhost:8081').cursor()
6-
cursor.execute("select null as db, name as name, database as schema, if(engine = 'VIEW', 'view', 'table') as type from system.tables where database = 'default';")
5+
conn = connector.connect("http://root:[email protected]:8000/default")
6+
cursor = conn.cursor()
7+
cursor.execute(
8+
"select null as db, name as name, database as schema, if(engine = 'VIEW', 'view', 'table') as type from system.tables where database = 'default';")
79
# print(cursor.fetchone())
810
print(cursor.fetchall())
911
print(cursor.description)
10-
11-
# for i in cursor.next():
12-
# print(i)
12+
conn.close()
1313

1414

1515
if __name__ == '__main__':

0 commit comments

Comments
 (0)