Skip to content

Commit 8b59b81

Browse files
committed
SQL-Like expressions
1 parent 782bea5 commit 8b59b81

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

mkdocs/docs/recipe-count.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,12 @@ print(f"Total rows in table: {row_count}")
3535
Count rows matching specific conditions:
3636

3737
```python
38-
from pyiceberg.expressions import GreaterThan, EqualTo, And
39-
4038
# Count rows with population > 1,000,000
4139
large_cities = table.scan().filter("population > 1000000").count()
4240
print(f"Large cities: {large_cities}")
4341

4442
# Count rows with specific country and population criteria
45-
filtered_count = table.scan().filter(
46-
And(EqualTo("country", "Netherlands"), GreaterThan("population", 100000))
47-
).count()
43+
filtered_count = table.scan().filter("country = 'Netherlands' AND population > 100000").count()
4844
print(f"Dutch cities with population > 100k: {filtered_count}")
4945
```
5046

@@ -62,9 +58,7 @@ limited_count = table.scan().count(limit=10000)
6258
print(f"Row count (max 10k): {limited_count}")
6359

6460
# Combine limit with filters for efficient targeted counting
65-
recent_orders_sample = table.scan().filter(
66-
GreaterThan("order_date", "2023-01-01")
67-
).count(limit=5000)
61+
recent_orders_sample = table.scan().filter("order_date > '2023-01-01'").count(limit=5000)
6862
print(f"Recent orders (up to 5000): {recent_orders_sample}")
6963
```
7064

0 commit comments

Comments
 (0)