Forum Discussion
Anonymous
2 years agoYou’d have a couple different things going on. I suggest trying to break down your code into separate functions.
- Bring the data into a dictionary from your input CSV - several examples on the internet. Reply here if your google-fu turns up nothing useful
- Convert the dictionary to a list of dictionaries - example below
- POST/PUT/PATCH the object in LM using the SDK (I only mention that because it’s in the title of this post) - Documentation here.
Example to translate properties into something that can be patched in:
myDictionary = {"corp.building":"Some Building Name","corp.department":"Some Department Name","corp.role":"Some Role"}
myListofDicts = [{"name":k,"value":v} for k,v in myDictionary.items()]
pprint(myListofDicts)
[{'name': 'corp.building', 'value': 'Some Building Name'},
{'name': 'corp.department', 'value': 'Some Department Name'},
{'name': 'corp.role', 'value': 'Some Role'}]