-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
71 lines (58 loc) · 2.23 KB
/
main.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
from upload_drivers import update_dim_drivers
from upload_payments import update_fact_payments
from upload_waybills import update_fact_waybills
from upload_cars import update_dim_cars
from upload_clients import update_dim_clients
from upload_rides import update_fact_rides
from upload_drivers_payments import update_drivers_payments
from upload_drivers_violation import update_drivers_violations
from upload_drivers_overtime import update_drivers_overtime
from upload_clients_hist import upload_clients_hist
import schedule
import time
def update():
print(f'[{time.ctime()}] Upload start')
# 1. payments
print('fact_payments start update')
if update_fact_payments() == []:
print('fact_payments succesfully updated')
# 2. clients
print('Dim_clients start update')
if update_dim_clients() == 'OK':
print('Dim_cients succesfully updated')
# 3. drivers
print('Dim_drivers start update')
if update_dim_drivers() == 'OK':
print('Dim_drivers succesfully updated')
# 4. cars
print('dim_cars start update')
if update_dim_cars() == 'OK':
print('dim_cars succesfully updated')
# 5. waybills
print('fact_waybills start update')
if update_fact_waybills() == []:
print('fact_waybills succesfully updated')
# 6. rides
print('fact_rides start update')
if update_fact_rides() == 'OK':
print('fact_rides succesfully updated')
print('drivers_payments start update')
if update_drivers_payments() == "OK":
print('drivers_payments successfully updated')
print('drivers_violations start update')
if update_drivers_violations() == "OK":
print('drivers_violations successfully updated')
print('drivers_overtime start update')
if update_drivers_overtime() == "OK":
print('drivers_overtime successfully updated')
print('clients_hist start update')
if upload_clients_hist() == "OK":
print('clients_hist successfully updated')
print(f'[{time.ctime()}] Upload end')
return
update()
#запуск загрузки данных каждые 24 часа
schedule.every(24).hours.do(update)
while True:
schedule.run_pending()
time.sleep(1)