How to get types python?

#1

What is the correct syntax for calling MyType.get("my_id") in python via c3 remote?

c3.MyType.get("my_id")

returns the following error:

C3RuntimeException: 400 - BadField - c3.love.typesys.obj.FunctionTypeImpl_coerceArguments [9024.148]
message: "Required argument missing for function MyType.get: this"
JSON: {'include': 'my_id'}

Server version is 7.8.8.

#2

Here is the correct syntax:

c3.MyType.get(this={"id":"my_id"})

#3

I actually prefer:
c3.MyType(id="my_id").get()

Member functions are nice, use them :slight_smile:

#4

I am now working on the platform, and have a python method defined on a type. The method calls c3.MyType(id="my_id").get() and returns the following error:

TypeError: 'C3Type' object is not callable.

What is causing this discrepancy, and what is the correct syntax to use?

Server version is 7.8.8.

#5

per @dennis.wang:

"One potential difference between using c3remote and running on server is the “type” of connection you are getting:
c3remote in a notebook always gets the full type (remote-types) connection
python method in a server gets the connection type that’s specified in the py-env (i.e. may not be remote-types) "

I added the following line to the runtime definition I am using in package.json and fixed the issue:
"connector":"remote-types"