Skip to content

Commit f930e37

Browse files
committed
Update materials after TR
1 parent 6df6a07 commit f930e37

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

crud-operations/crud_sql.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@ def connect_to_db(db_path):
66

77

88
if __name__ == "__main__":
9-
connection = connect_to_db("birds.db")
10-
create_bird_table = """
11-
CREATE TABLE IF NOT EXISTS bird (
12-
id INTEGER PRIMARY KEY AUTOINCREMENT,
13-
name TEXT NOT NULL
14-
);
15-
"""
16-
connection.execute(create_bird_table)
17-
connection.close()
9+
with connect_to_db("birds.db") as connection:
10+
connection.execute("""
11+
CREATE TABLE IF NOT EXISTS bird (
12+
id INTEGER PRIMARY KEY AUTOINCREMENT,
13+
name TEXT NOT NULL
14+
);
15+
""")

0 commit comments

Comments
 (0)