Merge branch 'master' into master
This commit is contained in:
commit
ae26e44cc2
|
@ -10,6 +10,7 @@ services:
|
|||
command: make test
|
||||
environment:
|
||||
SQLALCHEMY_DATABASE_URI: postgresql://lemur:lemur@postgres:5432/lemur
|
||||
VIRTUAL_ENV: 'true'
|
||||
|
||||
postgres:
|
||||
image: postgres:9.4
|
||||
|
|
|
@ -268,6 +268,11 @@ def clone(model):
|
|||
|
||||
|
||||
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.session.execute(count_q).scalar()
|
||||
return count
|
||||
|
|
Loading…
Reference in New Issue