Hi,

Looks like it converting key in string when I am doing put

gfsh>put --region=/CUSTOMER_1 
--key='("CustomerKey","customerID":1,"cycleCode":1,"customerGroup":1000,"partitionID":100)'
  --value=foo

but Region key is CustomerKey class object.

gfsh>query --query='select e.key from /CUSTOMER_1.entrySet e'

               name                | customerID | customerGroup | cycleCode | 
partitionID | Result
---------------------------------- | ---------- | ------------- | --------- | 
----------- | 
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
amdocs.imdg.model.keys.CustomerKey | 1592       | 30006         | 1         | 
300062      | 
{"customerID":1,"cycleCode":1,"customerGroup":1000,"partitionID":100,"type-class":"amdocs.imdg.model.keys.CustomerKey"}
amdocs.imdg.model.keys.CustomerKey | 3258       | 30005         | 1         | 
300058      | 
{'customerID':1010,'customerGroup':30006,'cycleCode':1,'partitionID':300066}
amdocs.imdg.model.keys.CustomerKey | 1593       | 30013         | 1         | 
300133      | 
{\"customerID\":1000,\"customerGroup\":30006,\"cycleCode\":1,\"partitionID\":300066}
amdocs.imdg.model.keys.CustomerKey | 54         | 30011         | 1         | 
300114      | 
{"name":"amdocs.imdg.model.keys.CustomerKey","customerID":1,"cycleCode":1,"customerGroup":1000,"partitionID":100,"type-class":"amdocs.imdg.model.keys.CustomerKey"}
amdocs.imdg.model.keys.CustomerKey | 386        | 30014         | 1         | 
300146      | null
amdocs.imdg.model.keys.CustomerKey | 1591       | 30003         | 1         | 
300031      | null
amdocs.imdg.model.keys.CustomerKey | 1594       | 30010         | 1         | 
300104      | null
null                               | null       | null          | null      | 
null        | null
null                               | null       | null          | null      | 
null        | null
null                               | null       | null          | null      | 
null        | null
null                               | null       | null          | null      | 
null        | null


-----Original Message-----
From: Swapnil Bawaskar [mailto:sbawas...@pivotal.io] 
Sent: Thursday, August 17, 2017 10:32 PM
To: dev@geode.apache.org
Cc: bogle...@pivotal.io
Subject: Re: How to export region keys in json file

I think you need to wrap the entire json string in quotes. From GEODE-3001
<https://issues.apache.org/jira/browse/GEODE-3001>:

gfsh>put --key-class=io.pivotal.gemfire.testing.MyKey
--key="{'identifier': 'KIWI131117+65', 'name':'name'}" --value=foo2 
--region=/foo



On Thu, Aug 17, 2017 at 6:15 AM Dinesh Akhand <dines...@amdocs.com> wrote:

> Hi I tried below,
>
> gfsh>query --query='select e.key from /CUSTOMER_1.entrySet e'
>
> Result     : true
> startCount : 0
> endCount   : 20
> Rows       : 7
>
>                name                | customerID | cycleCode |
> customerGroup | partitionID
> ---------------------------------- | ---------- | --------- |
> ------------- | -----------
> amdocs.imdg.model.keys.CustomerKey | 1592       | 1         | 30006
>  | 300062
>
>
> but when I ran
>
> gfsh>remove --region=/ CUSTOMER_1
> --key={\"customerID\":1592,\"customerGroup\":30006,\"cycleCode\":1,\"p
> artitionID\":300062} --key-class=amdocs.imdg.model.keys.CustomerKey
> Result    : false
> Message   : Key is not present in the region
> Key Class : java.lang.String
> Key       :
> {\"customerID\":1592,\"customerGroup\":30006,\"cycleCode\":1,\"partiti
> onID\":300062} --key-class=amdocs.imdg.model.keys.CustomerKey
>
> Showing error key not exist.
>
> We have customerID=LONG type
> cycleCode = short
> customerGroup = int
> partitionID =int
>
> Can you please suggest.
>
> Thanks,
> Dinesh Akhand
>
>
> From: Barry Oglesby [mailto:bogle...@pivotal.io]
> Sent: Thursday, August 17, 2017 4:18 AM
> To: dev@geode.apache.org<mailto:dev@geode.apache.org>
> Subject: Re: How to export region keys in json file
>
> There isn't anything built in to export keys as JSON. There was some 
> talk about exporting values as JSON at one time, but that hasn't been done.
>
> I attached a function to dump the keys as JSON. It just logs them to 
> the terminal, but it can easily be changed to write them to a file.
>
> It dumps output like:
>
> Region data contains the following 34 keys:
>
> {"customerID":"28","customerGroup":"group-28","cycleCode":"cycleCode-2
> 8","partitionID":28}
>
> {"customerID":"21","customerGroup":"group-21","cycleCode":"cycleCode-2
> 1","partitionID":21}
>
> {"customerID":"68","customerGroup":"group-68","cycleCode":"cycleCode-6
> 8","partitionID":68}
>
> {"customerID":"81","customerGroup":"group-81","cycleCode":"cycleCode-8
> 1","partitionID":81}
>
> {"customerID":"35","customerGroup":"group-35","cycleCode":"cycleCode-3
> 5","partitionID":35}
>
> {"customerID":"90","customerGroup":"group-90","cycleCode":"cycleCode-9
> 0","partitionID":90}
>
> {"customerID":"15","customerGroup":"group-15","cycleCode":"cycleCode-1
> 5","partitionID":15}
>
> {"customerID":"44","customerGroup":"group-44","cycleCode":"cycleCode-4
> 4","partitionID":44}
>
>
> Thanks,
> Barry Oglesby
>
>
> On Wed, Aug 16, 2017 at 4:35 AM, Dinesh Akhand <dines...@amdocs.com 
> <mailto:dines...@amdocs.com>> wrote:
> Hi,
>
> How I can export Region keys in json file.
>
> It will help full for us to use get command or remove command for 
> particular key when we have the composite keys defined.
>
> get --region=/CUSTOMER_1
> --key=({'customerID':'1593','customerGroup':'30013','cycleCode':'1','p
> artitionID':'300133'}) --key-class=amdocs.imdg.model.keys.CustomerKey
> Message : Error in converting JSON Couldn't convert JSON to Object of 
> type class amdocs.imdg.model.keys.CustomerKey
>
>
> Thanks,
> Dinesh Akhand
> This message and the information contained herein is proprietary and 
> confidential and subject to the Amdocs policy statement,
>
> you may review at https://www.amdocs.com/about/email-disclaimer < 
> https://www.amdocs.com/about/email-disclaimer>
>
> This message and the information contained herein is proprietary and 
> confidential and subject to the Amdocs policy statement,
>
> you may review at https://www.amdocs.com/about/email-disclaimer < 
> https://www.amdocs.com/about/email-disclaimer>
>
This message and the information contained herein is proprietary and 
confidential and subject to the Amdocs policy statement,

you may review at https://www.amdocs.com/about/email-disclaimer 
<https://www.amdocs.com/about/email-disclaimer>

Reply via email to