利用python生成導(dǎo)入文件
創(chuàng)新互聯(lián)秉承實(shí)現(xiàn)全網(wǎng)價(jià)值營(yíng)銷的理念,以專業(yè)定制企業(yè)官網(wǎng),成都網(wǎng)站制作、成都做網(wǎng)站,重慶小程序開發(fā),網(wǎng)頁(yè)設(shè)計(jì)制作,手機(jī)網(wǎng)站開發(fā),成都全網(wǎng)營(yíng)銷推廣幫助傳統(tǒng)企業(yè)實(shí)現(xiàn)“互聯(lián)網(wǎng)+”轉(zhuǎn)型升級(jí)專業(yè)定制企業(yè)官網(wǎng),公司注重人才、技術(shù)和管理,匯聚了一批優(yōu)秀的互聯(lián)網(wǎng)技術(shù)人才,對(duì)客戶都以感恩的心態(tài)奉獻(xiàn)自己的專業(yè)和所長(zhǎng)。
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
path = r"F:\alien_invasion\DATA_BLKLISTS01A.del"
list = open(path,'w')
count1 = 1
print("開始執(zhí)行!" )
for i in range(10000000):
i = i+1
count1 +=1
randomcount = random.randint(0,9)
print("""%s,"8613%s%08d",1,1,"remarks",""" % (i,str(randomcount),count1))
list.writelines("""%s,"8613%s%08d",1,1,"remarks",\n""" % (i,str(randomcount),count1))
#函數(shù) writelines(list)函數(shù)writelines可以將list寫入到文件中,但是不會(huì)在list每個(gè)元素后加換行符,所以如果想每行都有換行符的話需要自己再加上。
print ("執(zhí)行結(jié)束!")
list.close()
利用db2 load工具導(dǎo)入數(shù)據(jù)
db2 connect to 數(shù)據(jù)庫(kù)名
創(chuàng)建500w數(shù)據(jù)表
db2 "CREATE TABLE XIFENFEI_LOAD(col1 INT NOT NULL primary key,
col2 CHAR(100) NOT NULL,
col3 VARCHAR(20) NOT NULL,
col4 VARCHAR(20) NOT NULL,
col5 VARCHAR(20) NOT NULL)"
導(dǎo)入500萬(wàn)數(shù)據(jù)
db2 load from /tmp/DATA_BLKLISTS01.del of del insert into XIFENFEI_LOAD1 nonrecoverable
創(chuàng)建1000w數(shù)據(jù)表
db2 "CREATE TABLE XIFENFEI_LOAD4(col1 BIGINT NOT NULL primary key,
col2 CHAR(100) NOT NULL,
col3 VARCHAR(20) NOT NULL,
col4 VARCHAR(20) NOT NULL,
col5 VARCHAR(20) NOT NULL)"
導(dǎo)入1000萬(wàn)數(shù)據(jù)
db2 load from /tmp/DATA_BLKLISTS01A.del of del insert into XIFENFEI_LOAD4 nonrecoverable
文章名稱:db2快速創(chuàng)建千萬(wàn)級(jí)模擬數(shù)據(jù)
瀏覽路徑:http://jinyejixie.com/article16/pshegg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計(jì)公司、網(wǎng)站維護(hù)、網(wǎng)頁(yè)設(shè)計(jì)公司、響應(yīng)式網(wǎng)站、品牌網(wǎng)站制作、品牌網(wǎng)站設(shè)計(jì)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)