yhat / db.py

db.py is an easier way to interact with your databases
BSD 2-Clause "Simplified" License
1.22k stars 111 forks source link

feature: add 'count' property/method or __len__ to Table to get the number of rows #63

Closed garaud closed 9 years ago

garaud commented 9 years ago

Hi,

I would like to get the number of rows in a specific table. Is it possible to add a count or rows method/property to the Table class? You can also add the __len__ special method.

Moreover, this number of rows will be added to the TableSet repr.

Cheers, Damien

maurobaraldi commented 9 years ago

The line counting feature has different implementations between databases. The best approach here, could be to count the result from all method in class Table. I think it should be a property.

glamp commented 9 years ago

@maurobaraldi :+1:

maurobaraldi commented 9 years ago

This issue can be closed. The pull request 64 already merged, meet the needs of this request.

garaud commented 9 years ago

Quite efficient and responsive. Thanks !!