-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_db.py
More file actions
26 lines (21 loc) · 709 Bytes
/
setup_db.py
File metadata and controls
26 lines (21 loc) · 709 Bytes
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
import sqlite3
conn = sqlite3.connect('firms.db')
cursor = conn.cursor()
cursor.execute('''
CREATE TABLE IF NOT EXISTS firms (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
borough TEXT NOT NULL,
contact TEXT NOT NULL,
phone TEXT NOT NULL
)
''')
sample_firms = [
("Legal Aid Society", "Brooklyn", "Sarah Johnson", "555-0123"),
("Community Legal", "Manhattan", "Mike Chen", "555-0456"),
("Justice Partners", "Queens", "Lisa Rodriguez", "555-0789")
]
cursor.executemany('INSERT INTO firms (name, borough, contact, phone) VALUES (?, ?, ?, ?)', sample_firms)
conn.commit()
conn.close()
print("Database created successfully!")