def insert_data(list_sip_elements): # Prepare SQL query to INSERT a record into the database. sql = ("INSERT INTO sip_elements(general_id, vendor_pid, ppr_document, red_seal, technical_spec, final_item_form, " "total_program_quantity, color_standard, production_color, trim_accessories, yellow_seal, " "product_testing_result, floor_ready_requirement, retail_packaging_design, carton_mark, " "factory_internal_report, tcps_report, completed_packing_list) " "VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)") du.insert_many(sql, list_sip_elements)
def insert_data(general_info): # Prepare SQL query to INSERT a record into the database. sql = ( "INSERT INTO general_info(vendor_id, factory_id, bmp_vendor, auditor, frm_level, date_created) VALUES (%s, %s, %s, %s, %s, %s) RETURNING id" ) print('SQL INSERT: ', sql % general_info.get_data()) return du.insert(sql, general_info.get_data())
def insert_data(factory): # Prepare SQL query to INSERT a record into the database. sql = ( "INSERT INTO factory(code, name, address, contacts) VALUES (%s, %s, %s, %s) RETURNING id" ) print('SQL INSERT: ', sql % factory.get_data()) return du.insert(sql, factory.get_data())
def insert_data(vendor): # Prepare SQL query to INSERT a record into the database. sql = ( "INSERT INTO vendor(code, name, contacts) VALUES (%s, %s, %s) RETURNING id;" ) print('SQL INSERT: ', sql % vendor.get_data()) return du.insert(sql, vendor.get_data())
def insert_data(list_pom_items): # Prepare SQL query to INSERT a record into the database. sql = ( "INSERT INTO pom_info(general_id, vendor_pid, dpci, po_included, insp_type, po_qty, available_qty, description, is_pwi) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)" ) du.insert_many(sql, list_pom_items)
def insert_data(list_items): # Prepare SQL query to INSERT a record into the database. sql = ( "INSERT INTO item_info(general_id, item, item_description, po_number, order_qty, available_qty, vendor_pid, " "assortment_items) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)") du.insert_many(sql, list_items)
def get_factory_by_code(code): # Prepare SQL query to get user location. sql = ("SELECT id FROM factory WHERE code = '%s'") results = du.execute(sql % code) return results
def get_vendor_by_code(code): sql = ("SELECT id FROM vendor WHERE code = '%s'") results = du.execute(sql % code) return results
def insert_data(list_pifs): # Prepare SQL query to INSERT a record into the database. sql = ( "INSERT INTO pif_info(general_id, vendor_pid, po_number, purpose, ship_begin_date, ship_end_date) VALUES (%s, %s, %s, %s, %s, %s)" ) du.insert_many(sql, list_pifs)