-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclaimdata.py
36 lines (28 loc) · 956 Bytes
/
claimdata.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
import mysql.connector
import yaml
import json
with open('credentials.json','r') as file:
data = json.load(file)
mydb = mysql.connector.connect(
host=data['host'],
user=data['user'],
password=data['password'],
database=data['database']
)
mycursor = mydb.cursor()
mycursor.execute("SELECT * FROM griefprevention_claimdata")
myresult = mycursor.fetchall()
for x in myresult:
data = {
'Lesser Boundary Corner':x[2],
'Greater Boundary Corner': x[3],
'Owner': x[1],
'Builders': [uuid for uuid in x[4].split(';')[:-1]],
'Containers': [uuid for uuid in x[5].split(';')[:-1]],
'Accessors': [uuid for uuid in x[6].split(';')[:-1]],
'Managers': [uuid for uuid in x[7].split(';')[:-1]],
'Parent Claim ID': x[9],
'inheritNothing': False if x[8] == 0 else True
}
with open(f'Claimdata/{x[0]}.yml','w') as f:
yaml.dump(data,f,sort_keys=False)