Exemple #1
0
Created on Wed Aug  5 00:00:15 2020

@author: sysadmin
"""


import dtcfg as cfg
import pandas as pd
import os, base64

def myDecode(encStr):
    return base64.b64decode(encStr).decode()

if __name__ == '__main__':
    t0 = cfg.timeStart()
    localSQL= cfg.MSSQL(cfg.host, cfg.user, cfg.pwd, cfg.lcdb)
    localSQL.Connect()
    if not localSQL.isConnect:
        print(localSQL.host + ' not connect')
    else:
        #load sql file
        sqlword="SELECT * FROM pyFileDT"
        fdata= pd.read_sql(sqlword, con=localSQL.conn)
        listFile= os.listdir()
        for inde in fdata.index:
            fileName= fdata.loc[inde, 'file_name'] +'.py'
            sqlmtime= fdata.loc[inde, 'mtime']
            if fileName== 'loadPyFile.py':
                continue
            if not fileName in listFile or int(os.stat(fileName).st_mtime)< sqlmtime:
                ftxt= myDecode(fdata.loc[inde, 'file_content'])
Exemple #2
0
Created on Mon Aug  3 09:06:12 2020

@author: Administrator
"""

import pandas as pd
import random
import time as ti
import dtcfg as cfg
from WindPy import w
w.start()


if __name__ == '__main__':
    t0 = cfg.timeStart()
    localSQL= cfg.MSSQL(cfg.host, cfg.user, cfg.pwd, cfg.lcdb)
    localSQL.Connect()
    recordSQL= cfg.MSSQL(cfg.host, cfg.user, cfg.pwd, cfg.rcddb)
    recordSQL.Connect()
    if not localSQL.isConnect:
        print(localSQL.host + ' not connect')
    elif not recordSQL.isConnect:
        print(recordSQL.host + ' not connect')
    else:
        listDate= localSQL.getDate('TFDT')
        srData=pd.DataFrame()
        for tdate in listDate:
            if tdate< cfg.startDate:
                continue
            #tdate= listDate[0]
            print('dealing date: %d, time elapsed: %.2f min'% (tdate, (ti.time() - t0)/60))