Skip to content

Commit 12f76ab

Browse files
authored
Merge branch 'main' into upgrade-to-v25.5.2.47
2 parents cc12677 + d4f2c62 commit 12f76ab

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

chdb/session/state.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import tempfile
2-
import shutil
31
import warnings
42

53
import chdb
@@ -51,11 +49,9 @@ def __init__(self, path=None):
5149
)
5250
g_session.close()
5351
g_session_path = None
54-
if path is None or ":memory:" in path:
55-
self._cleanup = True
56-
self._path = tempfile.mkdtemp()
52+
if path is None:
53+
self._path = ":memory:"
5754
else:
58-
self._cleanup = False
5955
self._path = path
6056
if chdb.g_udf_path != "":
6157
self._udf_path = chdb.g_udf_path
@@ -84,8 +80,6 @@ def __exit__(self, exc_type, exc_value, traceback):
8480
self.close()
8581

8682
def close(self):
87-
if self._cleanup:
88-
self.cleanup()
8983
if self._conn is not None:
9084
self._conn.close()
9185
self._conn = None
@@ -95,13 +89,7 @@ def close(self):
9589

9690
def cleanup(self):
9791
try:
98-
if self._conn is not None:
99-
self._conn.close()
100-
self._conn = None
101-
shutil.rmtree(self._path)
102-
global g_session, g_session_path
103-
g_session = None
104-
g_session_path = None
92+
self.close()
10593
except: # noqa
10694
pass
10795

programs/local/LocalServer.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,10 @@ void LocalServer::tryInitPath()
364364
temporary_directory_to_delete = default_path;
365365

366366
path = default_path.string();
367+
367368
LOG_DEBUG(log, "Working directory will be created as needed: {}", path);
369+
370+
getClientConfiguration().setString("path", path);
368371
}
369372

370373
global_context->setPath(fs::path(path) / "");

0 commit comments

Comments
 (0)