创造测试数据,但是一直进不去循环不知道为什么?
#!/usr/bin/python
# coding:utf-8
# author:hutong
import time
# 构造表pms_parking_info
def park():
start = time.time()
# 定义需要生成的数据量
count = 10 # 1万
beginID = 666
try:
with open("/Users/zln/user.txt", "wb") as fo:
length = count + 1
for i in range(49, length):
while i>=49:
id=str(i+1)
while beginID>=666:
thirdParkId=str(beginID+i)
tenantId = 13
areaId = 91
pathCode = '0001.0001.0001'
aliParkId = '#'
thirdSourceType = 0
code = 140128443739145215
localCode = '#'
dockId = '#'
name = 'JOJOJO'
fullName = 'jiojiodsaaa'
status = 1
platformSupport = 1
level = 0
chargeFee = 1
supportAppointment = 0
outTime = 1
type = 1, 2, 3
lotType = 1
logo = "http"
openStartTime = '00:00'
openEndTime = '23:59'
chargeMode = 2
payMode = 1
payType = 1
latitude = 30.068776
longitude = 119.939741
provinceCode = 110000
cityCode = 110100
countyCode = 110101
address = '12'
lotTotal = 200
lotFixed = 0
description = '#'
auditStatus = 2
auditUserId = 1
auditUserName = 'administrator'
runStatus = '4'
creatorUserId = 73
creationTime = '2019-02-06 11:32:02'
lastModifierUserId = '2019-02-26 11:32:02'
lastModificationTime = '2019-02-27 16:21:42'
deleterUserId = 'null'
deletionTime = 'null'
deleted = 0
version = 1
freeTime = 15
pms_parking_info = (
"INSERT INTO 'xcp_cloud'.'pms_parking_info' VALUES ('%s', '%s', '%s','%s', '%s', '%s', '%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s',);"
% (id, tenantId, areaId, pathCode, aliParkId, thirdSourceType, thirdParkId, code, localCode, dockId, name, fullName, status, platformSupport, level, chargeFee, supportAppointment, outTime, type, lotType, logo, openStartTime, openEndTime, chargeMode, payMode, payType, latitude, longitude, provinceCode, cityCode, countyCode, address, lotTotal, lotFixed, description, auditStatus, auditUserId, auditUserName, time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()), runStatus, creatorUserId, creationTime, lastModifierUserId, lastModificationTime, deleterUserId, deletionTime, deleted, version, freeTime)
)
pms_parking_info = pms_parking_info + '\n'
fo.write(pms_parking_info.encode('UTF-8'))
print('共创建1万条sql耗时:', time.time() - start)
except Exception as e:
print(Exception, ":", e)
if __name__ == "__main__":
park()