Skip to content

Commit

Permalink
Add a fix by retain reference
Browse files Browse the repository at this point in the history
  • Loading branch information
mewim committed Dec 19, 2022
1 parent c1af1e5 commit 9dee3eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tools/python_api/src_py/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

class connection:
def __init__(self, database, num_threads=0):
self.database = database
self._connection = _kuzu.connection(database, num_threads)

def set_max_threads_for_exec(self, num_threads):
self._connection.set_max_threads_for_exec(num_threads)

def execute(self, query, parameters=[]):
return QueryResult(self._connection.execute(query, parameters))
return QueryResult(self, self._connection.execute(query, parameters))
3 changes: 2 additions & 1 deletion tools/python_api/src_py/query_result.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class QueryResult:
def __init__(self, query_result):
def __init__(self, connection, query_result):
self.connection = connection
self._query_result = query_result

def __del__(self):
Expand Down

0 comments on commit 9dee3eb

Please sign in to comment.