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 Weston Pace
parent f3a905af63
commit f17d16f935
2 changed files with 23 additions and 1 deletions

View File

@@ -646,8 +646,19 @@ class LanceTable(Table):
self._dataset.restore()
self._reset_dataset()
def count_rows(self, filter: Optional[str] = None) -> int:
"""
Count the number of rows in the table.
Parameters
----------
filter: str, optional
A SQL where clause to filter the rows to count.
"""
return self._dataset.count_rows(filter)
def __len__(self):
return self._dataset.count_rows()
return self.count_rows()
def __repr__(self) -> str:
return f"LanceTable({self.name})"