@@ -0,0 +1,840 @@
+# muddersOnRails()%0A# Sara McAllister November 5, 2-17%0A# Last updated: 11-5-2017%0A%0A# library for SQLite database calls for teamwork analysis app%0A%0Aimport contextlib%0Aimport sqlite3%0A%0ADB = 'db/development.sqlite3'%0A%0Adef connect(sqlite_file):%0A    %22%22%22 Make connection to an SQLite database file %22%22%22%0A    conn = sqlite3.connect(sqlite_file)%0A    c = conn.cursor()%0A    return conn, c%0A%0Adef close(conn):%0A    %22%22%22 Commit changes and close connection to the database %22%22%22%0A    conn.commit()%0A    conn.close()%0A%0A@contextlib.contextmanager%0Adef dbconnect(sqlite_file=DB):%0A  conn, cursor = connect(sqlite_file)%0A  try:%0A    yield cursor%0A  finally:%0A    close(conn)%0A%0Adef getAllStyles():%0A    %22%22%22Get all style entries in db ordered based on entry in db%22%22%22%0A    with dbconnect() as cursor:%0A        scores = cursor.execute('SELECT * FROM styles').fetchall()%0A    return scores

Set up contextmanager for db cals