ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Needham <needb...@gmail.com>
Subject Re: Access a cache loaded by DataStreamer with SQL
Date Wed, 20 Mar 2019 17:59:45 GMT
I guess I am not understanding how to build this for multiple tables in a
cache that can be loaded using the datastreamer and are queryable from
DBeaver or tableau.

I changed the code to be

                     IgniteCache<Object, Object> testCache =
ignite.getOrCreateCache(new CacheConfiguration<>("MAIN")
            .setIndexedTypes(Long.class, Employee.class)
            .setIndexedTypes(Long.class, Department.class)
            );
            Employee e = new Employee(1, "Test", 123.34f, 3);
            try (IgniteDataStreamer<Long, Employee> ds =
ignite.dataStreamer("MAIN")) {
                ds.addData(1l, e);
            }
            Department d = new Department(1, "Main", 12, 3);
            try (IgniteDataStreamer<Long, Department> ds2 =
ignite.dataStreamer("MAIN")) {
                ds2.addData(1l, d);
            }



which created the two in the cache, but does not load anything to the
department table.

On Wed, Mar 20, 2019 at 10:01 AM Ilya Kasnacheev <ilya.kasnacheev@gmail.com>
wrote:

> Hello!
>
> I don't understand what you are doing here. Why do you have two employee
> tables here? What is desired table structure?
>
> Regards,
> --
> Ilya Kasnacheev
>
>
> ср, 20 мар. 2019 г. в 16:44, Mike Needham <needbrew@gmail.com>:
>
>> I have that part, what I dont understand is how I can create multiple
>> "Tables" within a Cache(Schema)?  I have the following code that is using a
>> simple Employee Class.
>>
>>             IgniteCache<Object, Object> testCache =
>> ignite.getOrCreateCache(new CacheConfiguration<>("MAIN")
>>             .setIndexedTypes(Long.class, Employee.class)
>>                     .setQueryEntities(Collections.singleton(
>>                         new QueryEntity(Integer.class,
>> String.class).setTableName("EMPLOYEE"))));
>>             Employee e = new Employee(1, "Test", 123.34f, 3);
>>             try (IgniteDataStreamer<Long, Employee> ds =
>> ignite.dataStreamer("MAIN")) {
>>                 ds.addData(1l, e);
>>             }
>>
>> how would one go about adding a second "Table" to the MAIN cache so that
>> it is queryable from DBeaver or other tools?
>>
>>
>> On Wed, Mar 20, 2019 at 4:29 AM Ilya Kasnacheev <
>> ilya.kasnacheev@gmail.com> wrote:
>>
>>> Hello!
>>>
>>> Please take a look at
>>> https://apacheignite.readme.io/docs/cache-queries#section-query-configuration-by-annotations
>>>
>>> Regards,
>>> --
>>> Ilya Kasnacheev
>>>
>>>
>>> вт, 19 мар. 2019 г. в 20:25, Mike Needham <needbrew@gmail.com>:
>>>
>>>> Do you have an example of how that could be done.  I am struggling to
>>>> figure out how to set this up.
>>>>
>>>> On Mon, Mar 18, 2019 at 2:00 AM Ilya Kasnacheev <
>>>> ilya.kasnacheev@gmail.com> wrote:
>>>>
>>>>> Hello!
>>>>>
>>>>> The best approach is to use .setIndexedTypes() instead of
>>>>> setQueryEntities(), and annotate complex types in question with
>>>>> @QuerySqlField.
>>>>> This way you can then pour those types into cache and it will work
>>>>> transparently.
>>>>>
>>>>> Regards,
>>>>> --
>>>>> Ilya Kasnacheev
>>>>>
>>>>>
>>>>> пт, 15 мар. 2019 г. в 18:28, Mike Needham <needbrew@gmail.com>:
>>>>>
>>>>>> Perfect, now the next question is how would you do this for a more
>>>>>> complex object/table?  Either one defined in a separate object or
via SQL
>>>>>> DDL?
>>>>>>
>>>>>> On Fri, Mar 15, 2019 at 9:05 AM Ilya Kasnacheev <
>>>>>> ilya.kasnacheev@gmail.com> wrote:
>>>>>>
>>>>>>> Hello!
>>>>>>>
>>>>>>> You will have to specify schema name (or cache name?) in ALLCAPS
>>>>>>> when creating cache.
>>>>>>>
>>>>>>> Regards,
>>>>>>> --
>>>>>>> Ilya Kasnacheev
>>>>>>>
>>>>>>>
>>>>>>> пт, 15 мар. 2019 г. в 16:45, Mike Needham <needbrew@gmail.com>:
>>>>>>>
>>>>>>>> I see.  did not have the "person" for the schema.  Is there
a way
>>>>>>>> to not have the quotes around that?
>>>>>>>>
>>>>>>>> On Fri, Mar 15, 2019 at 7:59 AM ilya.kasnacheev <
>>>>>>>> ilya.kasnacheev@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Hello!
>>>>>>>>>
>>>>>>>>> Definitely works for me in DBeaver with this exact code:
>>>>>>>>>
>>>>>>>>> <
>>>>>>>>> http://apache-ignite-users.70518.x6.nabble.com/file/t1312/dbeaver-tables.png>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Some of DBeaver's introspection does not work but statements
are
>>>>>>>>> solid.
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> *Some days it just not worth chewing through the restraints*
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> *Some days it just not worth chewing through the restraints*
>>>>>>
>>>>>
>>>>
>>>> --
>>>> *Some days it just not worth chewing through the restraints*
>>>>
>>>
>>
>> --
>> *Some days it just not worth chewing through the restraints*
>>
>

-- 
*Some days it just not worth chewing through the restraints*

Mime
View raw message