generated from BYUIDSS/blank_project_repository
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmesh.py
29 lines (22 loc) · 897 Bytes
/
mesh.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 mesh:
def __init__(self, cvcursor, cvconn):
self.cvcursor = cvcursor
self.cvconn = cvconn
def insert_mesh(self, mesh):
self.cvcursor.execute('INSERT INTO mesh (mesh_type) VALUES (%s)', (mesh,))
self.cvconn.commit()
def select_mesh(self):
self.cvcursor.execute('SELECT * FROM mesh')
return self.cvcursor.fetchall()
def display_mesh(self):
df = pd.DataFrame(self.select_mesh())
df.columns = ['Mesh Id', 'Mesh']
return df
def update_mesh(self, mesh_id, mesh):
self.cvcursor.execute('UPDATE mesh SET mesh_type = %s WHERE mesh_id = %s', (mesh, mesh_id))
self.cvconn.commit()
def delete_mesh(self, mesh_id):
self.cvcursor.execute('DELETE FROM mesh WHERE mesh_id = %s', (mesh_id,))
self.cvconn.commit()
## added code for commit