-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit_library.py
34 lines (28 loc) · 1.01 KB
/
init_library.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# init_library.py
import sqlite3
def init_library_db():
conn = sqlite3.connect('library_items.db')
cursor = conn.cursor()
# Create the library_items table if it doesn't exist
cursor.execute('''
CREATE TABLE IF NOT EXISTS library_items (
ItemID INTEGER PRIMARY KEY AUTOINCREMENT,
Title TEXT,
AuthorArtistDirector TEXT,
PublisherLabelStudio TEXT,
PublicationYearReleaseYear INTEGER,
Type TEXT,
AvailableStatus TEXT,
Quantity INTEGER
)
''')
'''
# Insert initial data
cursor.execute(
"INSERT INTO library_items (Title, AuthorArtistDirector, PublisherLabelStudio, PublicationYearReleaseYear, Type, AvailableStatus, Quantity) VALUES (?, ?, ?, ?, ?, ?, ?)",
('Computer Science Textbook', 'James', 'Lion Publisher', None, 'Book', 'Available', 1))
'''
conn.commit()
conn.close()
if __name__ == '__main__':
init_library_db()