generated from BYUIDSS/blank_project_repository
-
Notifications
You must be signed in to change notification settings - Fork 1
/
fastener.py
29 lines (22 loc) · 1001 Bytes
/
fastener.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
import pandas as pd
class fastener:
def __init__(self, cvcursor, cvconn):
self.cvcursor = cvcursor
self.cvconn = cvconn
def insert_fastener(self, fastener):
self.cvcursor.execute('INSERT INTO fastener (fastener_type) VALUES (%s)', (fastener,))
self.cvconn.commit()
def select_fastener(self):
self.cvcursor.execute('SELECT * FROM fastener')
return self.cvcursor.fetchall()
def display_fastener(self):
df = pd.DataFrame(self.select_fastener())
df.columns = ['Fastener Id', 'Fastener']
return df
def update_fastener(self, fastener_id, fastener):
self.cvcursor.execute('UPDATE color SET fastener_type = %s WHERE fastener_id = %s', (fastener, fastener_id))
self.cvconn.commit()
def delete_fastener(self, fastener_id):
self.cvcursor.execute('DELETE FROM fastener WHERE fastener_id = %s', (fastener_id,))
self.cvconn.commit()
## added code to commit