Couls you please specify the exact versions of pyignite and ignite-core
(java thin client)?

ср, 21 дек. 2022 г., 18:36 Айсина Роза Мунеровна <roza.ays...@sbermarket.ru
>:

> Hola again!
>
> I accidently discovered some strange behaviour when trying to get value by
> key in Python.
>
> I do this in part 3:
>
> cache = ignite_client.get_cache("PUBLIC_ProductFeatures")
> key = IoSbmtProductFeaturesKey(product_sku=15052004)
> cursor = cache.scan(partitions=1)
>
> # Uncomment to see error
> # value = cache.get(key)
>
> true_key, true_value = next(cursor)  # THIS LINE IS CRUCIAL!!!11
> print("true_key:  ", true_key)
> print("true_value:", true_value)
>
> value = cache.get(key)
>
>
> So if data from cursor is read first then everything works as expected.
> If there is no cursor or reading data from it happens AFTER cache.get(key)
> - everything fails and key is not found.
>
> Is it ok?
> Maybe there is some dynamic binding of classes?
> Looks really weird.
>
> Help please!
>
> On 20 Dec 2022, at 1:35 PM, Айсина Роза Мунеровна <
> roza.ays...@sbermarket.ru> wrote:
>
> Hola!
> I can’t get data by key in Python in caches created in Java with binary
> objects.
>
> 1. Cache was created though DDL in SQL API:
>
> CREATE TABLE IF NOT EXISTS PUBLIC.ProductFeatures
> (
>      product_sku INT PRIMARY KEY,
>      total_cnt_orders_with_sku INT
> )
> WITH "CACHE_NAME=PUBLIC_ProductFeatures,
>      KEY_TYPE=io.sbmt.ProductFeaturesKey,
>      VALUE_TYPE=io.sbmt.ProductFeaturesValue,
>      AFFINITY_KEY=product_sku,
>      TEMPLATE=PARTITIONED,
>      BACKUPS=1”
>
> 2. Java apps uploads data to this cache through Key-Value API with binary
> object underneath:
>
> ClientCache<BinaryObject, BinaryObject> igniteCache = igniteClient
>      .cache(config.getCacheName())
>      .withKeepBinary();
>
> final BinaryObjectBuilder keyBuilder =
> igniteClient.binary().builder(config.getKeyType());
> final BinaryObjectBuilder valueBuilder =
> igniteClient.binary().builder(config.getValueType());
>
> keyBuilder.setField(column.name, id);
> valueBuilder.setField(column.name, id);
>
> final BinaryObject key = keyBuilder.build();
> final BinaryObject value = valueBuilder.build();
>
> igniteCache.put(key, value);
>
>
> 3. In Python client I create Complex Object class and try to get data from
> this cache:
>
> class IoSbmtProductFeaturesKey(
>     metaclass=GenericObjectMeta,
>     schema={
>         'product_sku': IntObject
>     },
>     type_name='io.sbmt.ProductFeaturesKey'
> ):
>     pass
>
>
> ignite_client.register_binary_type(IoSbmtProductFeaturesKey)
>
> key = IoSbmtProductFeaturesKey(product_sku=15052004)
> cache = ignite_client.get_cache("PUBLIC_ProductFeatures")
> value = cache.get(key)
>
> cursor = cache.scan(partitions=1)  # to check that key really exists
> true_key, true_value = next(cursor)
>
>
> What I see:
>
> >>> *true_key*
> IoSbmtProductFeaturesKey(product_sku=15052004, version=1)
> >>> *key*
> IoSbmtProductFeaturesKey(product_sku=15052004, version=1)
> >>> *true_key == key*
> True
> >>> *cache.get(true_key)*
> IoSbmtProductFeaturesValue(total_cnt_orders_with_sku=12, version=1)
> >>> *cache.get(true_key) == true_value*
> True
> >>> *cache.get(key)*
> >>> *type(cache.get(key))*
> <class 'NoneType'>
>
> So I can’t create Python analogue of Java binary class that is stored as
> key in the cache.
> I tried also to change case in schema of python class, check all this on
> cache with composite key, to not specify *type_id* - nothing helps :(
>
> Please help.
>
> *--*
>
> *Роза Айсина*
> Старший разработчик ПО
> *СберМаркет* | Доставка из любимых магазинов
>
>
> Email: roza.ays...@sbermarket.ru
> Mob:
> Web: sbermarket.ru
> App: iOS
> <https://apps.apple.com/ru/app/%D1%81%D0%B1%D0%B5%D1%80%D0%BC%D0%B0%D1%80%D0%BA%D0%B5%D1%82-%D0%B4%D0%BE%D1%81%D1%82%D0%B0%D0%B2%D0%BA%D0%B0-%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82%D0%BE%D0%B2/id1166642457>
> и Android
> <https://play.google.com/store/apps/details?id=ru.instamart&hl=en&gl=ru>
>
>
>
>
>
>
>
> *УВЕДОМЛЕНИЕ О КОНФИДЕНЦИАЛЬНОСТИ:* это электронное сообщение и любые
> документы, приложенные к нему, содержат конфиденциальную информацию.
> Настоящим уведомляем Вас о том, что, если это сообщение не предназначено
> Вам, использование, копирование, распространение информации, содержащейся в
> настоящем сообщении, а также осуществление любых действий на основе этой
> информации, строго запрещено. Если Вы получили это сообщение по ошибке,
> пожалуйста, сообщите об этом отправителю по электронной почте и удалите это
> сообщение.
> *CONFIDENTIALITY NOTICE:* This email and any files attached to it are
> confidential. If you are not the intended recipient you are notified that
> using, copying, distributing or taking any action in reliance on the
> contents of this information is strictly prohibited. If you have received
> this email in error please notify the sender and delete this email.
> *--*
>
> *Роза Айсина*
> Старший разработчик ПО
> *СберМаркет* | Доставка из любимых магазинов
>
>
> Email: roza.ays...@sbermarket.ru
> Mob:
> Web: sbermarket.ru
> App: iOS
> <https://apps.apple.com/ru/app/%D1%81%D0%B1%D0%B5%D1%80%D0%BC%D0%B0%D1%80%D0%BA%D0%B5%D1%82-%D0%B4%D0%BE%D1%81%D1%82%D0%B0%D0%B2%D0%BA%D0%B0-%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82%D0%BE%D0%B2/id1166642457>
> и Android
> <https://play.google.com/store/apps/details?id=ru.instamart&hl=en&gl=ru>
>
>
>
>
>
> *--*
>
> *Роза Айсина*
>
> Старший разработчик ПО
>
> *СберМаркет* | Доставка из любимых магазинов
>
>
>
> Email: roza.ays...@sbermarket.ru
>
> Mob:
>
> Web: sbermarket.ru
>
> App: iOS
> <https://apps.apple.com/ru/app/%D1%81%D0%B1%D0%B5%D1%80%D0%BC%D0%B0%D1%80%D0%BA%D0%B5%D1%82-%D0%B4%D0%BE%D1%81%D1%82%D0%B0%D0%B2%D0%BA%D0%B0-%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82%D0%BE%D0%B2/id1166642457>
> и Android
> <https://play.google.com/store/apps/details?id=ru.instamart&hl=en&gl=ru>
>
>
>
> *УВЕДОМЛЕНИЕ О КОНФИДЕНЦИАЛЬНОСТИ:* это электронное сообщение и любые
> документы, приложенные к нему, содержат конфиденциальную информацию.
> Настоящим уведомляем Вас о том, что, если это сообщение не предназначено
> Вам, использование, копирование, распространение информации, содержащейся в
> настоящем сообщении, а также осуществление любых действий на основе этой
> информации, строго запрещено. Если Вы получили это сообщение по ошибке,
> пожалуйста, сообщите об этом отправителю по электронной почте и удалите это
> сообщение.
> *CONFIDENTIALITY NOTICE:* This email and any files attached to it are
> confidential. If you are not the intended recipient you are notified that
> using, copying, distributing or taking any action in reliance on the
> contents of this information is strictly prohibited. If you have received
> this email in error please notify the sender and delete this email.
>

Reply via email to