Skip to content

Commit

Permalink
Create a count query class
Browse files Browse the repository at this point in the history
  • Loading branch information
keiranjprice101 committed Aug 1, 2019
1 parent 12affc7 commit b6897fb
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions common/database_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,20 @@ def commit_changes(self):
self.session.close()



class CountQuery(Query):

def __init__(self, table):
super().__init__(table)
self.include_related_entities = False

def execute_query(self):
self.commit_changes()

def get_count(self):
self.execute_query()
return self.base_query.count()

class ReadQuery(Query):

def __init__(self, table):
Expand Down

0 comments on commit b6897fb

Please sign in to comment.