当前位置: 首页>>代码示例>>Python>>正文


Python Connections.getCursor方法代码示例

本文整理汇总了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()
开发者ID:okrane,项目名称:framework,代码行数:33,代码来源:ImportIndicators.py


注:本文中的lib.dbtools.connections.Connections.getCursor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。