clutchski / caribou

A small, simple Python migrations library for SQLite databases.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

replace "execute" context manager with contextlib.closing

clutchski opened this issue · comments

for example,

with execute(self.conn, sql, [VERSION_TABLE]) as cursor:
    return bool(cursor.fetchall())

is the same as:

with contextlib.closing(self.conn.execute(sql, [VERSION_TABLE]) as cursor:
      return bool(cursor.fetchall())