You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here are the contents of the Delta table after the overwrite operation:
54
87
55
88
```
@@ -63,9 +96,20 @@ Here are the contents of the Delta table after the overwrite operation:
63
96
64
97
Overwriting just performs a logical delete. It doesn't physically remove the previous data from storage. Time travel back to the previous version to confirm that the old version of the table is still accessable.
65
98
66
-
```python
67
-
dt = DeltaTable("tmp/some-table", version=1)
99
+
=== "Python"
68
100
101
+
```python
102
+
dt = DeltaTable("tmp/some-table", version=1)
103
+
```
104
+
105
+
=== "Rust"
106
+
```rust
107
+
let mut table = open_table("tmp/some-table").await?;
Copy file name to clipboardexpand all lines: docs/usage/deleting-rows-from-delta-lake-table.md
+23-5
Original file line number
Diff line number
Diff line change
@@ -17,11 +17,29 @@ Suppose you have the following Delta table with four rows:
17
17
18
18
Here's how to delete all the rows where the `num` is greater than 2:
19
19
20
-
```python
21
-
dt = DeltaTable("tmp/my-table")
22
-
dt.delete("num > 2")
23
-
```
24
-
20
+
=== "Python"
21
+
22
+
```python
23
+
dt = DeltaTable("tmp/my-table")
24
+
dt.delete("num > 2")
25
+
```
26
+
27
+
=== "Rust"
28
+
```rust
29
+
let table = deltalake::open_table("./data/simple_table").await?;
30
+
let (table, delete_metrics) = DeltaOps(table)
31
+
.delete()
32
+
.with_predicate(col("num").gt(lit(2)))
33
+
.await?;
34
+
```
35
+
`with_predicate` expects an argument that can be translated to a Datafusion `Expression`. This can be either using the Dataframe API, or using a `SQL where` clause:
36
+
```rust
37
+
let table = deltalake::open_table("./data/simple_table").await?;
38
+
let (table, delete_metrics) = DeltaOps(table)
39
+
.delete()
40
+
.with_predicate("num > 2")
41
+
.await?;
42
+
```
25
43
Here are the contents of the Delta table after the delete operation has been performed:
0 commit comments