Skip to content

Commit 64f3872

Browse files
test
1 parent c89f411 commit 64f3872

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

singlestoredb/magics/run_personal.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import os
2-
import time
32
from typing import Any
43

54
from IPython.core.interactiveshell import InteractiveShell
@@ -42,16 +41,13 @@ def run_personal(self, line: str, local_ns: Any = None) -> Any:
4241
if not personal_file:
4342
raise ValueError('No personal file specified.')
4443

45-
local_filename = (
46-
f'{int(time.time() * 1_000_000)}_{personal_file}'.replace(' ', '_')
47-
)
48-
sql_command = f"DOWNLOAD PERSONAL FILE '{personal_file}' TO '{local_filename}'"
44+
sql_command = f"DOWNLOAD PERSONAL FILE '{personal_file}' TO '{personal_file}'"
4945

5046
# Execute the SQL command
5147
self.shell.run_line_magic('sql', sql_command)
5248
# Run the downloaded file
53-
self.shell.run_line_magic('run', local_filename)
49+
self.shell.run_line_magic('run', "'" + personal_file + "'")
5450

5551
# Delete the local file after running it
56-
if os.path.exists(local_filename):
57-
os.remove(local_filename)
52+
if os.path.exists(personal_file):
53+
os.remove(personal_file)

singlestoredb/magics/run_shared.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import os
2-
import time
32
from typing import Any
43

54
from IPython.core.interactiveshell import InteractiveShell
@@ -42,14 +41,13 @@ def run_shared(self, line: str, local_ns: Any = None) -> Any:
4241
if not shared_file:
4342
raise ValueError('No personal file specified.')
4443

45-
local_filename = f'{int(time.time() * 1_000_000)}_{shared_file}'.replace(' ', '_')
46-
sql_command = f"DOWNLOAD SHARED FILE '{shared_file}' TO '{local_filename}'"
44+
sql_command = f"DOWNLOAD SHARED FILE '{shared_file}' TO '{shared_file}'"
4745

4846
# Execute the SQL command
4947
self.shell.run_line_magic('sql', sql_command)
5048
# Run the downloaded file
51-
self.shell.run_line_magic('run', local_filename)
49+
self.shell.run_line_magic('run', "'" + shared_file + "'")
5250

5351
# Delete the local file after running it
54-
if os.path.exists(local_filename):
55-
os.remove(local_filename)
52+
if os.path.exists(shared_file):
53+
os.remove(shared_file)

0 commit comments

Comments
 (0)