Upsert to an entity type directly from python function


#1

For 7.8.2+ server, can I upsert to an entity type directly in python?

def myFunc():
  //type.upsert({id: XXX})?
  //c3.type.upsert({id: XXX})?
  //do I need to import any package? pyc3?

#2

You don’t need to import pyc3. The variable c3 is always available in python server code (don’t override it!).

To upset an instance:

my_object = c3.MyType(**kwargs)
c3.MyType.upsert(this=my_object)

#4

read more Call C3 IoT from Python