本文整理汇总了Python中lib.dbtools.connections.Connections.getCursor方法的典型用法代码示例。如果您正苦于以下问题:Python Connections.getCursor方法的具体用法?Python Connections.getCursor怎么用?Python Connections.getCursor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.dbtools.connections.Connections
的用法示例。
在下文中一共展示了Connections.getCursor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ImportIndicators
# 需要导入模块: from lib.dbtools.connections import Connections [as 别名]
# 或者: from lib.dbtools.connections.Connections import getCursor [as 别名]
def ImportIndicators(DataBase, l_indicator, perimeter, path):
outfile = open('%s/security_indicator_dump.txt' %path,'w')
Connections.change_connections('production')
cursor, cxn = Connections.getCursor(DataBase)
if perimeter == 'all':
for indicator_id in l_indicator:
query = "select ci.indicator_id, cii.name, ci.indicator_value, ci.security_id, ci.trading_destination_id ,erc.EXCHGID " \
"from MARKET_DATA..ci_security_indicator ci " \
"left join KGR..EXCHANGEREFCOMPL erc on (erc.EXCHANGE = ci.trading_destination_id) " \
"left join MARKET_DATA..ci_indicator cii on (cii.indicator_id = ci.indicator_id) " \
"where (erc.GLOBALZONEID = 1 or erc.GLOBALZONEID is NULL) and ci.indicator_id in (%s) " \
"and (ci.trading_destination_id > 0 or ci.trading_destination_id is NULL) " \
"order by ci.indicator_id, ci.security_id, ci.trading_destination_id" %(indicator_id)
cursor.execute(query)
result = cursor.fetchall()
for line in result:
if line[5] is None:
line[5] = 'AGGR'
str_line = ''
for item in line:
str_line = "%s%s;" %(str_line, item)
str_line = '%s\n' %str_line[:-1]
outfile.write(str_line)
outfile.close()