Пример #1
0
os.environ['ORACLE_HOME'] = 'F:\\SMnRa\\smnra\\python\\3\\instantclient_12_1'
os.environ['TNS_ADMIN'] = 'F:\\SMnRa\\smnra\\python\\3\\instantclient_12_1'

import cx_Oracle  #导入oracle 支持模块
import os  #导入系统 模块
import datetime  #导入 时间日期 模块
import pandas as pd
import getfiles
import SMTPProxy

start_datetime = (datetime.date.today() - datetime.timedelta(days=1)
                  ).strftime("%Y%m%d") + '00'  # 昨天的日期 '2017102500'
end_datetime = datetime.date.today().strftime(
    "%Y%m%d") + '00'  # 今天的日期 '2017102600'

sqlFiles = getfiles.getGzipList(os.getcwd() + '\\lte_sql', '.SQL')

sqls = []  #存储sql脚本的列表
sheetNames = []  #存放sheet名
for i, sqlFile in enumerate(sqlFiles):
    sheetNames.append(
        sqlFile.decode('utf-8').replace(os.getcwd() + '\\lte_sql\\',
                                        '').split('.')[0])  #将文件名作为sheet名存入
    tmp = open(sqlFile.decode('utf-8'), mode='r', encoding='cp936')
    try:
        sqls.append(tmp.read())
    except Exception as e:
        print(str(e))
    finally:
        tmp.close()
Пример #2
0
os.environ['ORACLE_HOME'] = 'F:\\SMnRa\\smnra\\python\\3\\instantclient_12_1'
os.environ['TNS_ADMIN'] = 'F:\\SMnRa\\smnra\\python\\3\\instantclient_12_1'

import cx_Oracle  #导入oracle 支持模块
import os  #导入系统 模块
import datetime  #导入 时间日期 模块
import pandas as pd
import getfiles
import SMTPProxy

start_datetime = datetime.date.today().strftime(
    "%Y%m%d") + '00'  # 今天的日期 '2017102600'
end_datetime = datetime.date.today().strftime(
    "%Y%m%d") + '13'  # 今天的日期 '2017102613'

sqlFiles = getfiles.getGzipList(os.getcwd() + '\\wcdma_sql', '.SQL')

sqls = []  #存储sql脚本的列表
sheetNames = []  #存放sheet名
for i, sqlFile in enumerate(sqlFiles):
    sheetNames.append(
        sqlFile.decode('utf-8').replace(os.getcwd() + '\\wcdma_sql\\',
                                        '').split('.')[0])  #将文件名作为sheet名存入
    tmp = open(sqlFile.decode('utf-8'), mode='r', encoding='cp936')
    try:
        sqls.append(tmp.read())
    except Exception as e:
        print(str(e))
    finally:
        tmp.close()