Example #1
0
def employee():
    api_method = 'employee/v2/queryEmployee'
    # api_bodyValue= ''
    km = KangMian(api_method, '{}')
    responseData = km.callAPI()
    emp = ParseEmployee()
    sqlDict, colDict = emp.getTabAndSql_Dict()

    list_sql = Util.dealResponseData(responseData, sqlDict, colDict)
    print(len(list_sql))
    pg = pypgsql.dba()
    pg.execListSql(list_sql)
Example #2
0
 def dealRespnoseData(self):
     # # 全量数据先删除
     # self.truncateTable()
     # 拿到结构
     self.getDataBaseDict()
     responseData = self.callAPI()
     print('返回' + str(responseData) + '条数据')
     if len(responseData) == 0:
         return 0
     list_sql = Util.dealResponseData(responseData, self.sqlDict,
                                      self.colDict)
     print(len(list_sql))
     pg = pypgsql.dba()
     pg.execListSql(list_sql)
     return 1
Example #3
0
    'store_v1_querystore_linkmans'
]

pg = pypgsql.dba()
sql_truncate = 'truncate table '
for _ in tableName:
    _sql = sql_truncate + schemaName + '.' + _ + ';'
    print(_sql)
    pg.execsql(_sql)

i = 0
while True:
    i += 1
    api_bodyValue = '{"page_number":"' + str(i) + '"}'
    print(api_bodyValue)
    # exit(0)
    km = KangMian(api_method, api_bodyValue)
    # 拿到ResponData
    responseData = km.callAPI()
    if len(responseData) == 0:
        break
    # 拿到对应的数据库结构
    sqlDict, colDict = common.getDict(schemaName, tableName)

    list_sql = Util.dealResponseData(responseData, sqlDict, colDict)
    print(len(list_sql))
    t1 = time.time()

    pg.execListSql(list_sql)
    print(time.time() - t1)