We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 99e90a5 commit 35d5231Copy full SHA for 35d5231
qiita_db/support_files/patches/python_patches/31.py
@@ -1,6 +1,11 @@
1
from os.path import realpath
2
-from qiita_db.sql_connection import SQLConnectionHandler
+from qiita_db.sql_connection import TRN
3
4
-conn = SQLConnectionHandler()
5
-path = conn.execute_fetchone('SELECT base_data_dir FROM settings')[0]
6
-conn.execute("UPDATE settings SET base_data_dir = %s", (realpath(path),))
+with TRN:
+ TRN.add('SELECT base_data_dir FROM settings')
+ path = TRN.execute_fetchlast()
7
+
8
+ # if the path is non-canonical (it contains .. or other redundant symbols)
9
+ # this will update it, else it will leave as is
10
+ TRN.add("UPDATE settings SET base_data_dir = %s", (realpath(path),))
11
+ TRN.execute()
0 commit comments