You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Stéphane Thibaud <sn...@gmail.com> on 2019/05/16 11:55:46 UTC

Ignite 'complex' type

Hello Ignite experts,

I am trying to store a python value of type

Tuple[Dict[str, float], bytes]

in an Ignite cache. However, doing that without type hints I get:

TypeError: Type `array of None` is invalid

Do you know if this is possible?


Kind regards,

Stéphane Thibaud

Re: Ignite 'complex' type

Posted by Stéphane Thibaud <sn...@gmail.com>.
Thank you Dmitry. I will use serialization in this case.


Kind regards,

Stéphane Thibaud

2019年5月21日(火) 9:01 Dmitry Melnichuk <dm...@nobitlost.com>:

> Stéphane,
>
> I afraid this won't work. Ignite storage is typed, thus you can not use
> values of arbitrary type, but only of Pythonic types that defined
> here[1].
>
> If you really want to store such a complex object as a whole, you can
> either
>
> 1) serialize it with pickle/dill/protobuf/json/et c. and store as a
> StringObject or a ByteArrayObject, or
>
> 2) define a class with a GenericObjectMeta[2] metaclass, with unique
> class name and a schema. It will be an object of a special class, not
> an arbitrary typed value, but it may do the job for you.
>
> [1]
>
> https://apacheignite.readme.io/docs/python-thin-client-initialization-and-configuration#section-data-types
>
> [2] https://apacheignite.readme.io/docs/python-thin-client-binary-types
>
> On Tue, 2019-05-21 at 07:15 +0900, Stéphane Thibaud wrote:
> > Any thoughts about this one?
> >
> >
> > Kind regards,
> >
> > Stéphane Thibaud
> >
> > 2019年5月16日(木) 20:55 Stéphane Thibaud <sn...@gmail.com>:
> > > Hello Ignite experts,
> > >
> > > I am trying to store a python value of type
> > >
> > > Tuple[Dict[str, float], bytes]
> > >
> > > in an Ignite cache. However, doing that without type hints I get:
> > >
> > > TypeError: Type `array of None` is invalid
> > >
> > > Do you know if this is possible?
> > >
> > >
> > > Kind regards,
> > >
> > > Stéphane Thibaud
>
>

Re: Ignite 'complex' type

Posted by Dmitry Melnichuk <dm...@nobitlost.com>.
Stéphane,

I afraid this won't work. Ignite storage is typed, thus you can not use
values of arbitrary type, but only of Pythonic types that defined
here[1].

If you really want to store such a complex object as a whole, you can
either

1) serialize it with pickle/dill/protobuf/json/et c. and store as a
StringObject or a ByteArrayObject, or

2) define a class with a GenericObjectMeta[2] metaclass, with unique
class name and a schema. It will be an object of a special class, not
an arbitrary typed value, but it may do the job for you.

[1] 
https://apacheignite.readme.io/docs/python-thin-client-initialization-and-configuration#section-data-types

[2] https://apacheignite.readme.io/docs/python-thin-client-binary-types

On Tue, 2019-05-21 at 07:15 +0900, Stéphane Thibaud wrote:
> Any thoughts about this one?
> 
> 
> Kind regards,
> 
> Stéphane Thibaud
> 
> 2019年5月16日(木) 20:55 Stéphane Thibaud <sn...@gmail.com>:
> > Hello Ignite experts,
> > 
> > I am trying to store a python value of type 
> > 
> > Tuple[Dict[str, float], bytes]
> > 
> > in an Ignite cache. However, doing that without type hints I get:
> > 
> > TypeError: Type `array of None` is invalid
> > 
> > Do you know if this is possible?
> > 
> > 
> > Kind regards,
> > 
> > Stéphane Thibaud


Re: Ignite 'complex' type

Posted by Stéphane Thibaud <sn...@gmail.com>.
Any thoughts about this one?


Kind regards,

Stéphane Thibaud

2019年5月16日(木) 20:55 Stéphane Thibaud <sn...@gmail.com>:

> Hello Ignite experts,
>
> I am trying to store a python value of type
>
> Tuple[Dict[str, float], bytes]
>
> in an Ignite cache. However, doing that without type hints I get:
>
> TypeError: Type `array of None` is invalid
>
> Do you know if this is possible?
>
>
> Kind regards,
>
> Stéphane Thibaud
>