Skip to content

Commit

Permalink
Changed query to return and added fetch_all generator
Browse files Browse the repository at this point in the history
query() now returns a cursor for you to work with, while fetch_all now has the behavior that query() used to have
  • Loading branch information
kfsone committed Aug 5, 2014
1 parent 78edc32 commit aa04c40
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tradedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,8 @@ def query(self, sql):
conn = pypyodbc.connect(self.path)
cur = conn.cursor()
cur.execute(sql)
for row in cur:
yield row
return cur

def fetch_all(self, sql):
for row in self.query(sql):
yield row

0 comments on commit aa04c40

Please sign in to comment.