File tree Expand file tree Collapse file tree 2 files changed +38
-2
lines changed Expand file tree Collapse file tree 2 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -106,7 +106,8 @@ sess.query(
106106print (" Select from view:\n " )
107107print (sess.query(" SELECT * FROM db_xxx.view_xxx" , " Pretty" ))
108108```
109-
109+
110+ 参见: [ test_stateful.py] ( tests/test_stateful.py )
110111</details >
111112
112113<details >
@@ -126,6 +127,23 @@ conn1.close()
126127```
127128</details >
128129
130+ <details >
131+ <summary><h4>🗂️ Query with UDF(User Defined Functions)</h4></summary>
132+
133+ ``` python
134+ from chdb.udf import chdb_udf
135+ from chdb import query
136+
137+ @chdb_udf ()
138+ def sum_udf (lhs , rhs ):
139+ return int (lhs) + int (rhs)
140+
141+ print (query(" select sum_udf(12,22)" ))
142+ ```
143+
144+ 参见: [ test_udf.py] ( tests/test_udf.py ) .
145+ </details >
146+
129147更多示例,请参见 [ examples] ( examples ) 和 [ tests] ( tests ) 。
130148
131149## 演示和示例
Original file line number Diff line number Diff line change @@ -111,7 +111,8 @@ sess.query(
111111print (" Select from view:\n " )
112112print (sess.query(" SELECT * FROM db_xxx.view_xxx" , " Pretty" ))
113113```
114-
114+
115+ see also: [ test_stateful.py] ( tests/test_stateful.py ) .
115116</details >
116117
117118<details >
@@ -132,6 +133,23 @@ conn1.close()
132133</details >
133134
134135
136+ <details >
137+ <summary><h4>🗂️ Query with UDF(User Defined Functions)</h4></summary>
138+
139+ ``` python
140+ from chdb.udf import chdb_udf
141+ from chdb import query
142+
143+ @chdb_udf ()
144+ def sum_udf (lhs , rhs ):
145+ return int (lhs) + int (rhs)
146+
147+ print (query(" select sum_udf(12,22)" ))
148+ ```
149+
150+ see also: [ test_udf.py] ( tests/test_udf.py ) .
151+ </details >
152+
135153For more examples, see [ examples] ( examples ) and [ tests] ( tests ) .
136154
137155<br >
You can’t perform that action at this time.
0 commit comments