Skip to content

Commit 60e3b94

Browse files
committed
drop the gil over more ExtractStatements
1 parent 57d66a5 commit 60e3b94

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tools/pythonpkg/src/pyconnection.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,13 @@ py::list DuckDBPyConnection::ListFilesystems() {
332332
}
333333

334334
py::list DuckDBPyConnection::ExtractStatements(const string &query) {
335+
vector<unique_ptr<SQLStatement>> statements;
336+
{
337+
py::gil_scoped_release gil;
338+
statements = connection.ExtractStatements(query);
339+
}
335340
py::list result;
336341
auto &connection = con.GetConnection();
337-
auto statements = connection.ExtractStatements(query);
338342
for (auto &statement : statements) {
339343
result.append(make_uniq<DuckDBPyStatement>(std::move(statement)));
340344
}
@@ -624,6 +628,7 @@ vector<unique_ptr<SQLStatement>> DuckDBPyConnection::GetStatements(const py::obj
624628
}
625629
if (py::isinstance<py::str>(query)) {
626630
auto sql_query = std::string(py::str(query));
631+
py::gil_scoped_release gil;
627632
return connection.ExtractStatements(sql_query);
628633
}
629634
throw InvalidInputException("Please provide either a DuckDBPyStatement or a string representing the query");

0 commit comments

Comments
 (0)