-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.py
40 lines (28 loc) · 1.44 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
from Primavera_REST_Api import Primavera
from dotenv import load_dotenv
import os
load_dotenv()
EPPM_LOGIN = os.getenv('eppm_login')
EPPM_PASSWORD = os.getenv('eppm_password')
EPPM_DATABASE = os.getenv('eppm_database')
EPPM_PREFIX = os.getenv('eppm_prefix')
PROJECT_SHORT_CODE = "testproj"
EXPORT_TABLES_TO_CSV = True # Export Tables to CSV file
app = Primavera(rest_api_prefix=EPPM_PREFIX,
database_name=EPPM_DATABASE,
login=EPPM_LOGIN,
password=EPPM_PASSWORD)
app.select_project(projectId=PROJECT_SHORT_CODE)
if EXPORT_TABLES_TO_CSV:
# Export tables to CSV files
directory = 'csv'
app.project.export_to_CSV(directory=directory, fields=['Id', 'Name'])
app.wbs.export_to_CSV(fields=['ParentObjectId', 'ObjectId', 'Name', 'Code'], directory=directory)
app.activity.export_to_CSV(fields=['ObjectId', 'Id', 'Name', 'PlannedDuration',
'StartDate', 'FinishDate', 'ActualDuration'], directory=directory)
app.resource.export_to_CSV(fields=['ObjectId', 'Id', 'Name'], directory=directory)
app.resourceAssignment.export_to_CSV(
fields=['ActivityObjectId', 'ResourceObjectId', 'PlannedUnits', 'ActivityId', 'ResourceId'], directory=directory)
app.resourceRole.export_to_CSV(directory=directory)
app.role.export_to_CSV(directory=directory)
# app.activity.import_CSV_to_EPPM(directory='csv', filename='import - activity.csv', delimiter=',')