curr_build_snapshot_id = buildmonitor_db.get_value_from_query_data(query, query_data)
#print '[%s] curr_build_snapshot_id(%s)\n' % (__file__, curr_build_snapshot_id)
+ # bulk insert
+ query = "INSERT INTO build_snapshot_package (build_snapshot_id, repository, " \
+ "arch, package_name, created_date, package_size, package_url) " \
+ "VALUES(%s, %s, %s, %s, %s, %s, %s)"
+
+ query_list = []
for each_pkg_name, each_pkg_mdate, each_pkg_size in zip(bm_pkg_name_lst, bm_pkg_mdate_lst, bm_pkg_size_lst):
timestamp = datetime.datetime.fromtimestamp(each_pkg_mdate)
- #print '[%s] each_pkg_name(%s), timestamp(%s), each_pkg_size(%s)\n' \
+ #print '[%s] each_pkg_name(%s), timestamp(%s), each_pkg_size(%s)' \
# % (__file__, each_pkg_name, timestamp, each_pkg_size)
- query = "INSERT INTO build_snapshot_package (build_snapshot_id, repository, " \
- "arch, package_name, created_date, package_size, package_url) " \
- "VALUES(%s, %s, %s, %s, %s, %s, %s)"
- query_data = (curr_build_snapshot_id, bm_repo, bm_arch, each_pkg_name,
- timestamp, each_pkg_size, bm_pkg_url)
- buildmonitor_db.do_query(query, query_data)
+ query_list.append((curr_build_snapshot_id, bm_repo, bm_arch,
+ each_pkg_name, timestamp, each_pkg_size, bm_pkg_url))
+
+ buildmonitor_db.do_many_query(query, query_list)
def end_pre_create_snapshot_for_sr_stage(project, bm_git_tag,
bm_start_datetime, bm_end_datetime):
curr_build_snapshot_id = buildmonitor_db.get_value_from_query_data(query, query_data)
print '[%s] curr_build_snapshot_id(%s)\n' % (__file__, curr_build_snapshot_id)
+
+ # bulk insert
+ query = "INSERT INTO build_snapshot_package (build_snapshot_id, repository, arch, " \
+ "package_name, created_date, package_size, package_url) " \
+ "VALUES(%s, %s, %s, %s, %s, %s, %s)"
+
+ query_list = []
for each_pkg_name, each_pkg_mdate, each_pkg_size in zip(bm_pkg_name_lst, bm_pkg_mdate_lst, bm_pkg_size_lst):
timestamp = datetime.datetime.fromtimestamp(each_pkg_mdate)
# post build
#print '[%s] curr_build_snapshot_id(%s), each_pkg_name(%s), timestamp(%s), each_pkg_size(%s)\n' \
# % (__file__, curr_build_snapshot_id, each_pkg_name, timestamp, each_pkg_size)
- query = "INSERT INTO build_snapshot_package (build_snapshot_id, repository, arch, " \
- "package_name, created_date, package_size, package_url) " \
- "VALUES(%s, %s, %s, %s, %s, %s, %s)"
- query_data = (curr_build_snapshot_id, bm_repo, bm_arch,
- each_pkg_name, timestamp, each_pkg_size, bm_pkg_url)
- buildmonitor_db.do_query(query, query_data)
+ query_list.append((curr_build_snapshot_id, bm_repo, bm_arch,
+ each_pkg_name, timestamp, each_pkg_size, bm_pkg_url))
+
+ buildmonitor_db.do_many_query(query, query_list)
def end_create_snapshot_create_images_for_sr_stage(bm_snapshot_name,
bm_start_datetime,
curr_build_snapshot_id = buildmonitor_db.get_value_from_query_data(query, query_data)
#print '[%s] curr_build_snapshot_id(%s)\n' % (__file__, curr_build_snapshot_id)
+ # bulk insert
+ query = "INSERT INTO build_snapshot_package (build_snapshot_id, repository, " \
+ "arch, package_name, created_date, package_size, package_url) " \
+ "VALUES(%s, %s, %s, %s, %s, %s, %s)"
+
+ query_list = []
for each_pkg_name, each_pkg_mdate, each_pkg_size in zip(bm_pkg_name_lst, bm_pkg_mdate_lst, bm_pkg_size_lst):
timestamp = datetime.datetime.fromtimestamp(each_pkg_mdate)
- #print '[%s] each_pkg_name(%s), timestamp(%s), each_pkg_size(%s)\n' \
+ #print '[%s] each_pkg_name(%s), timestamp(%s), each_pkg_size(%s)' \
# % (__file__, each_pkg_name, timestamp, each_pkg_size)
- query = "INSERT INTO build_snapshot_package (build_snapshot_id, repository, " \
- "arch, package_name, created_date, package_size, package_url) " \
- "VALUES(%s, %s, %s, %s, %s, %s, %s)"
- query_data = (curr_build_snapshot_id, bm_repo, bm_arch, each_pkg_name,
- timestamp, each_pkg_size, bm_pkg_url)
- buildmonitor_db.do_query(query, query_data)
+ query_list.append((curr_build_snapshot_id, bm_repo, bm_arch,
+ each_pkg_name, timestamp, each_pkg_size, bm_pkg_url))
+
+ buildmonitor_db.do_many_query(query, query_list)
def TRBS_end_pre_create_snapshot_for_sr_stage(project, bm_git_tag,
bm_start_datetime, bm_end_datetime):