Skip to content

Commit 16f88ac

Browse files
committed
Use output_format as cpp func 2nd arg
1 parent 0384b70 commit 16f88ac

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

programs/local/LocalChdb.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@ extern bool inside_main = true;
77

88

99
local_result * queryToBuffer(
10-
const std::string & queryStr, const std::string & format = "CSV", const std::string & path = {}, const std::string & udfPath = {})
10+
const std::string & queryStr,
11+
const std::string & output_format = "CSV",
12+
const std::string & path = {},
13+
const std::string & udfPath = {})
1114
{
1215
std::vector<std::string> argv = {"clickhouse", "--", "--multiquery"};
1316

1417
// If format is "Debug" or "debug", then we will add `--verbose` and `--log-level=trace` to argv
15-
if (format == "Debug" || format == "debug")
18+
if (output_format == "Debug" || output_format == "debug")
1619
{
1720
argv.push_back("--verbose");
1821
argv.push_back("--log-level=trace");
@@ -22,7 +25,7 @@ local_result * queryToBuffer(
2225
else
2326
{
2427
// Add format string
25-
argv.push_back("--output-format=" + format);
28+
argv.push_back("--output-format=" + output_format);
2629
}
2730

2831
// If udfPath is not empty, then we will add `--user_scripts_path` and `--user_defined_executable_functions_config` to argv
@@ -52,10 +55,13 @@ local_result * queryToBuffer(
5255

5356
// Pybind11 will take over the ownership of the `query_result` object
5457
// using smart ptr will cause early free of the object
55-
query_result *
56-
query(const std::string & queryStr, const std::string & format = "CSV", const std::string & path = {}, const std::string & udfPath = {})
58+
query_result * query(
59+
const std::string & queryStr,
60+
const std::string & output_format = "CSV",
61+
const std::string & path = {},
62+
const std::string & udfPath = {})
5763
{
58-
return new query_result(queryToBuffer(queryStr, format, path, udfPath));
64+
return new query_result(queryToBuffer(queryStr, output_format, path, udfPath));
5965
}
6066

6167
// The `query_result` and `memoryview_wrapper` will hold `local_result_wrapper` with shared_ptr
@@ -142,7 +148,7 @@ PYBIND11_MODULE(_chdb, m)
142148
"query",
143149
&query,
144150
py::arg("queryStr"),
145-
py::arg("format") = "CSV",
151+
py::arg("output_format") = "CSV",
146152
py::kw_only(),
147153
py::arg("path") = "",
148154
py::arg("udf_path") = "",

0 commit comments

Comments
 (0)