-
Notifications
You must be signed in to change notification settings - Fork 0
/
data_update_script.py
34 lines (30 loc) · 1.36 KB
/
data_update_script.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 4 11:12:20 2019
@author: Nagasudhir
"""
import datetime as dt
from wbes_full_sch_utils import getAllIsgsSchRowsForDate, getAllBuyerSchRowsForDate
from dc_from_oracle_to_pg import getDcDbRowsForDates
from sch_db_adapter import SchDbAdapter
def updateSchedules(targetDates):
# push full schedules
schAdapter = SchDbAdapter()
schAdapter.connectToDb()
for targetDt in targetDates:
# push seller full schedules
schRows = getAllIsgsSchRowsForDate(targetDt, revNum=None)
schAdapter.pushSchRows(schRows)
print('{0} seller sch push done at {1}'.format(
dt.datetime.strftime(targetDt, '%d-%m-%Y'), dt.datetime.strftime(dt.datetime.now(), '%d-%m-%Y %H:%M')))
# push buyer full schedules
schRows = getAllBuyerSchRowsForDate(targetDt, revNum=None)
schAdapter.pushSchRows(schRows)
print('{0} buyer sch push done at {1}'.format(
dt.datetime.strftime(targetDt, '%d-%m-%Y'), dt.datetime.strftime(dt.datetime.now(), '%d-%m-%Y %H:%M')))
# push dc schedules
schRows = getDcDbRowsForDates(targetDt, targetDt)
schAdapter.pushSchRows(schRows)
print('{0} dc push done at {1}'.format(dt.datetime.strftime(
targetDt, '%d-%m-%Y'), dt.datetime.strftime(dt.datetime.now(), '%d-%m-%Y %H:%M')))
schAdapter.disconnectDb()