Skip to content

Commit db48bfa

Browse files
committed
update order_by docstring
1 parent 7ba4477 commit db48bfa

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/datachain/lib/dc.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,10 +981,22 @@ def _extend_to_data_model(self, method_name, *args, **kwargs):
981981

982982
@resolve_columns
983983
def order_by(self, *args, descending: bool = False) -> "Self":
984-
"""Orders by specified set of signals.
984+
"""Orders by specified set of columns.
985985
986986
Parameters:
987987
descending (bool): Whether to sort in descending order or not.
988+
989+
Example:
990+
```py
991+
dc.order_by("similarity_score", descending=True).limit(10)
992+
```
993+
994+
Note:
995+
Order is not guaranteed when steps are added after an `order_by` statement.
996+
I.e. when using `from_dataset` an `order_by` statement should be used if
997+
the order of the records in the chain is important.
998+
Using `order_by` directly before `limit` will give expected results.
999+
See https://github.com/iterative/datachain/issues/477 for further details.
9881000
"""
9891001
if descending:
9901002
args = tuple(sqlalchemy.desc(a) for a in args)

0 commit comments

Comments
 (0)