test.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # coding=utf-8
  2. '''
  3. Created on Apr 21, 2016
  4. @author: root
  5. '''
  6. import os
  7. os.environ['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.UTF8'
  8. import cx_Oracle
  9. import time
  10. class Test(object):
  11. def __init__(self):
  12. pass
  13. if __name__ == '__main__':
  14. timeStart = time.time()
  15. conn = cx_Oracle.connect('uuplatformdemo/selectuuplatform@192.168.253.6/orcl')
  16. cursor = conn.cursor()
  17. # cursor.execute("select table_name, tablespace_name from user_tables")
  18. # cursor.execute("select * from product$brand_temp")
  19. # row = cursor.fetchone()
  20. # cursor.execute("select * from product$brand_temp")
  21. # cursor.execute ("INSERT INTO product$component_temp (ID, COL1, COL2, COL3)VALUES(1, 'a', 'b', 'c')")
  22. # cursor.execute ("INSERT INTO product$component_temp ( cmp_id, cmp_code, cmp_img, cmp_uuid, cmp_description, cmp_brid, cmp_kiid, cmp_company )VALUES(2, 'a', 'c', 'sdfs', 'c', 1, 1, 'c')")
  23. # cursor.execute ("INSERT INTO product$propertyvalue_temp (pv_id, pv_componentid, pv_detno, pv_propertyid, pv_value )VALUES(1, 1, 3, 1, '后壳')")
  24. list_test = list((i, 1, 1, 1, "wocalei") for i in range(1, 100000))
  25. cursor.prepare('insert into product$propertyvalue_temp (pv_id, pv_componentid, pv_detno, pv_propertyid, pv_value ) values(:1, :2, :3, :4, :5)') #
  26. cursor.executemany(None, list_test)
  27. # cursor.execute (sql_str)
  28. conn.commit()
  29. conn.commit()
  30. conn.commit()
  31. cursor.close ()
  32. conn.close ()
  33. timeEnd = time.time()
  34. timeCount = timeEnd - timeStart
  35. print (timeCount, "s")
  36. print (timeCount/60, "min")
  37. print (timeCount/3600, "h")