docstring
This commit is contained in:
parent
9ccd43c29b
commit
5e3add0b81
|
@ -268,6 +268,11 @@ def clone(model):
|
||||||
|
|
||||||
|
|
||||||
def get_count(q):
|
def get_count(q):
|
||||||
|
"""
|
||||||
|
Count the number of rows in a table. More efficient than count(*)
|
||||||
|
:param q:
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
count_q = q.statement.with_only_columns([func.count()]).order_by(None)
|
count_q = q.statement.with_only_columns([func.count()]).order_by(None)
|
||||||
count = q.session.execute(count_q).scalar()
|
count = q.session.execute(count_q).scalar()
|
||||||
return count
|
return count
|
||||||
|
|
Loading…
Reference in New Issue