Fix sql to return fewer results in subquery

Yay for the limit 1. I also fixed a bug I accidentally introduced when
cleaning up my debug statements
This commit is contained in:
Eli Ribble 2016-07-05 16:36:59 -06:00
parent 500787fbd6
commit 6e448640b7
1 changed files with 3 additions and 2 deletions

View File

@ -11,10 +11,11 @@ import vanth.tables
LOGGER = logging.getLogger(__name__)
def _select():
my_max = sqlalchemy.sql.functions.max(vanth.tables.OFXUpdate.c.created)
subselect = sqlalchemy.select([
vanth.tables.OFXUpdate.c.ofxaccount,
sqlalchemy.sql.functions.max(vanth.tables.OFXUpdate.c.created),
]).group_by(
my_max,
]).limit(1).group_by(
vanth.tables.OFXUpdate.c.ofxaccount
).alias('ofxupdates')
return sqlalchemy.select([