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: [email protected]<mailto:[email protected]>
Mob:
Web: sbermarket.ru<https://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.