预处理算法_2_类型转换
标签:数据 tar 预处理 The ams tput target dict file
#
def execute(conn, inputs, params, outputs, reportFileName):
#
‘‘‘
载入模块
‘‘‘
import sqlalchemy
import db_utils
‘‘‘
选择目标数据
‘‘‘
data_in = db_utils.query(conn, ‘select ‘ + params[‘columns‘] + ‘ from ‘ + inputs[‘data_in‘])
‘‘‘
列名为键,类型为值的字典
‘‘‘
modifi_type = params[‘modifi_type‘]
type_dict = {}
for i in eval(modifi_type):
if i[‘targetType‘] == ‘numeric‘:
type_dict[i[‘origName‘]] = eval((‘sqlalchemy.types.NUMERIC‘ + ‘(255,‘ + str(i[‘otherParam‘]) + ‘)‘))
elif i[‘targetType‘] == ‘text‘:
type_dict[i[‘origName‘]] = sqlalchemy.types.Text
elif i[‘targetType‘] == ‘date‘:
type_dict[i[‘origName‘]] = sqlalchemy.types.Date
else:
type_dict[i[‘origName‘]] = sqlalchemy.types.TIMESTAMP
# 写出数据
db_utils.modifyType(conn, outputs[‘data_out‘], data_in, type_dict)
#
预处理算法_2_类型转换
标签:数据 tar 预处理 The ams tput target dict file
原文地址:https://www.cnblogs.com/renfanzi/p/14476408.html
评论