File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed
include/duckdb_python/expression Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,10 @@ struct DuckDBPyExpression : public enable_shared_from_this<DuckDBPyExpression> {
8383 shared_ptr<DuckDBPyExpression> In (const py::args &args);
8484 shared_ptr<DuckDBPyExpression> NotIn (const py::args &args);
8585
86+ // TRY
87+
88+ shared_ptr<DuckDBPyExpression> Try ()
89+
8690 // Order modifiers
8791
8892 shared_ptr<DuckDBPyExpression> Ascending();
Original file line number Diff line number Diff line change @@ -226,6 +226,13 @@ shared_ptr<DuckDBPyExpression> DuckDBPyExpression::NotIn(const py::args &args) {
226226 return CreateCompareExpression (ExpressionType::COMPARE_NOT_IN, args);
227227}
228228
229+ // TRY
230+
231+ shared_ptr<DuckDBPyExpression> DuckDBPyExpression::Try () {
232+ return DuckDBPyExpression::InternalUnaryOperator (ExpressionType::OPERATOR_TRY, *this );
233+ }
234+
235+
229236// COALESCE
230237
231238shared_ptr<DuckDBPyExpression> DuckDBPyExpression::Coalesce (const py::args &args) {
@@ -431,6 +438,7 @@ shared_ptr<DuckDBPyExpression> DuckDBPyExpression::SQLExpression(string sql) {
431438 return make_shared_ptr<DuckDBPyExpression>(std::move (expressions[0 ]));
432439}
433440
441+
434442// Private methods
435443
436444shared_ptr<DuckDBPyExpression> DuckDBPyExpression::BinaryOperator (const string &function_name,
Original file line number Diff line number Diff line change @@ -367,6 +367,14 @@ void DuckDBPyExpression::Initialize(py::module_ &m) {
367367 )" ;
368368 expression.def (" isnotin" , &DuckDBPyExpression::NotIn, docs);
369369
370+ docs = R"(
371+ Create a TRY expression from self
372+
373+ Returns:
374+ DuckDBPyExpression: TRY(self)
375+ )" ;
376+ expression.def (" try" , &DuckDBPyExpression::Try, docs);
377+
370378 docs = R"(
371379 Return the stringified version of the expression.
372380
You can’t perform that action at this time.
0 commit comments