.make() doesn't work in python when it's fine in JS


#1

For 7.8.2+

var a = MyType.make(url='c3.ai')
a.compute()

works in JS

a = c3.MyType.make(url='c3.ai')
c3.MyType.compute(this=a)

doesn’t work in Python. The error message is

function metadata was not found for action Target [MyType?action=make]


#2

Try:

c3.MyType.compute(this={"url" : "c3.ai"})


#3

Javascript’s make() is just () in C3 remote python.

Instead of something like:

a = c3.MyType.make(url='c3.ai')

You would do:

a = c3.MyType(url='c3.ai')

#4

@Phoebus In what cases is it useful to make objects in Python? I thought it would always serialize anyway…


#5

We make objects in python all the time. Take a look at the tutorial python notebooks, in the /tutorials folder when you start C3’s Jupyter Service. For example, we make instances of SklearnPipe and upsert them.


#6

@romain.juban, to your point making C3 objects in Python became much more relevant since the introduction of C3.Remote.

It’s basically the same reason why you do make in JavaScript instead of using plain objects all the time.

I think that “making objects” has 2 main advantages:

  • we don’t do it at the moment, but if we evolve towards a thicker type system we’ll be able to check that you are setting properties correctly (correct names, correct value types)
  • you can use a dot notation syntax, instead of manipulating dictionaries, which is cleaner and opens the possibility for all sorts of magic on the type system side to give you more interesting results