You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by "kenn_thompson@qat.com" <ke...@qat.com> on 2017/11/17 19:59:25 UTC

Question about SQL -> Cache

(Context - working in C#)

Vanilla single node cluster, no persistence (yet). 

I executed a DDL statement via ODBC (CREATE TABLE BLAH (RecID varchar
PRIMARY KEY, Value1 varchar))

I see a cache was created via the web console (SQL_PUBLIC_BLAH).

I executed an Insert via ODBC (INSERT INTO BLAH (RecID, Value1) VALUES
('12345', '54321'))

I can see from the web console the new cache now contains 1 object. If I do
a select statement via ODBC and use an OdbcReader, I can read the values
back out.

Since I didn't define any classes, it is possible to now interact with the
cache not via ODBC, but via Ignite.NET and the cache/object directly in
code? What I'm trying to do is look at what the object looks like, and
potentially load the cache with a data mover routine to read from a source
db record, create an object in code from that record, add that object to the
cache, then use SQL to read the new object back out.

Currently, when I add an object to the cache manually (adding fields
manually), it doesn't get returned from ODBC/SQL. 



This is just a 



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Question about SQL -> Cache

Posted by Denis Magda <dm...@apache.org>.
Hello,

Yes, you can use both SQL and key-value APIs for the caches created with DDL.

There is a GitHub project that shows how to achieve this with JDBC and Java:
https://github.com/dmagda/ignite_world_demo <https://github.com/dmagda/ignite_world_demo>

The same can be done for ODBC and .NET. You just need to a cache name, key and value types as parameters to CREATE TABLE statement. Look for CACHE_NAME, KEY_TYPE and VALUE_TYPE here:
https://apacheignite-sql.readme.io/docs/create-table#section-parameters <https://apacheignite-sql.readme.io/docs/create-table#section-parameters>

—
Denis

> On Nov 17, 2017, at 11:59 AM, kenn_thompson@qat.com wrote:
> 
> (Context - working in C#)
> 
> Vanilla single node cluster, no persistence (yet). 
> 
> I executed a DDL statement via ODBC (CREATE TABLE BLAH (RecID varchar
> PRIMARY KEY, Value1 varchar))
> 
> I see a cache was created via the web console (SQL_PUBLIC_BLAH).
> 
> I executed an Insert via ODBC (INSERT INTO BLAH (RecID, Value1) VALUES
> ('12345', '54321'))
> 
> I can see from the web console the new cache now contains 1 object. If I do
> a select statement via ODBC and use an OdbcReader, I can read the values
> back out.
> 
> Since I didn't define any classes, it is possible to now interact with the
> cache not via ODBC, but via Ignite.NET and the cache/object directly in
> code? What I'm trying to do is look at what the object looks like, and
> potentially load the cache with a data mover routine to read from a source
> db record, create an object in code from that record, add that object to the
> cache, then use SQL to read the new object back out.
> 
> Currently, when I add an object to the cache manually (adding fields
> manually), it doesn't get returned from ODBC/SQL. 
> 
> 
> 
> This is just a 
> 
> 
> 
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/