-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_prods_table.py
41 lines (34 loc) · 1003 Bytes
/
create_prods_table.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
35
36
37
38
39
40
#use to create table for the first row of the products cvs. NOT FINISHED
import psycopg2
conn = psycopg2.connect("host=localhost dbname=mydb user=postgres password=asdf")
cur = conn.cursor()
def create_table():
try:
cur.execute("""
CREATE TABLE products
(Category text,
Product text,
Variant text,
Code integer PRIMARY KEY,
Supplier text,
UnitCost real,
UnitPrice real,
Discount real,
Type text,
UOM text,
Released text,
ID text,
ProductID text,
ProductCode text,
Product_Description text,
Description text,
Inventory_Cebu real,
Inventory_Dapa real,
Inventory_Gen_Luna real
)
""")
conn.commit()
except Exception as e:
print('something bad happened' + e)
if __name__ == '__main__':
create_table()