feat(python): add count_rows with filter option (#801)

Closes #795
This commit is contained in:
Chang She
2024-01-09 19:33:03 -08:00
committed by GitHub
parent 629379a532
commit d998f80b04
2 changed files with 23 additions and 1 deletions

View File

@@ -597,3 +597,14 @@ def test_compact_cleanup(db):
with pytest.raises(Exception, match="Version 3 no longer exists"):
table.checkout(3)
def test_count_rows(db):
table = LanceTable.create(
db,
"my_table",
data=[{"text": "foo", "id": 0}, {"text": "bar", "id": 1}],
)
assert len(table) == 2
assert table.count_rows() == 2
assert table.count_rows(filter="text='bar'") == 1