You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Andrey Mashenkov <an...@gmail.com> on 2018/02/01 10:30:24 UTC

Re: Question about 'table' created by JDBC

Hi,

1. No, it is not supported. It is possible to store entries of different
types in same cache, so such metadata is not available from cache level.
Types look strange as they are autogenerated names. Seems, you didn't
specify key\value types in create table clause [1] and no QueryEntity [2]
descibed in cache config.

2. No 'describe tablename' is supported. SQL system views are on design
stage for now and there an IEP-13 [3] document.
If you find smth is missed, please point us.


[1] https://apacheignite-sql.readme.io/docs/create-table
[2]
https://apacheignite.readme.io/docs/cache-queries#query-configuration-using-queryentity
[3]
https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=75962769

On Sun, Jan 21, 2018 at 5:16 AM, mamaco <ma...@163.com> wrote:

> Hi,
> I made a quick test to create a City table through DBeaver, and then I
> accessed it through java app successfully.
>
> But, when I loop the record, I found both of key and value were built by
> BinaryObject with strange type.
> Question 1:
> Is there any convenient API to get the type name from cache level?
> sth like this:
> cache.getMetrics.getBinaryTypeName().
> I'm just curious if JDBC operations could interact with JAVA api
>
> Question 2:
> In JDBC is there any command like 'describe tablename' to query cache
> structure?
>
>
>     public static void GetAll(IgniteCache<BinaryObject, BinaryObject>
> cache)
> {
>         Iterator<Cache.Entry&lt;BinaryObject, BinaryObject>>  itr =
> cache.iterator();
>         while(itr.hasNext()){
>                 Cache.Entry<BinaryObject, BinaryObject> item = itr.next();
>                 System.out.println("id="+item.getKey().field("id")+"
> KeyType="+item.getKey().type().typeName().toString());
>                 System.out.println("CITY="+item.getValue().field("name")+
> "
> ValueType="+item.getValue().type().typeName().toString());
>         }
>     }
> ---------------------------------------------------------
> id=1  KeyType=SQL_PUBLIC_CITY_9c004c1e_d2d2_4c13_8f38_5f2d266080f6_KEY
> CITY=Forest Hill
> ValueType=SQL_PUBLIC_CITY_9c004c1e_d2d2_4c13_8f38_5f2d266080f6
> id=3  KeyType=SQL_PUBLIC_CITY_9c004c1e_d2d2_4c13_8f38_5f2d266080f6_KEY
> CITY=St. Petersburg
> ValueType=SQL_PUBLIC_CITY_9c004c1e_d2d2_4c13_8f38_5f2d266080f6
> id=2  KeyType=SQL_PUBLIC_CITY_9c004c1e_d2d2_4c13_8f38_5f2d266080f6_KEY
> CITY=Denver  ValueType=SQL_PUBLIC_CITY_9c004c1e_d2d2_4c13_8f38_
> 5f2d266080f6
>
>
>     public static void Get(Ignite ignite, IgniteCache<BinaryObject,
> BinaryObject> cache) {
>         Long keyValue = 3L;
>         BinaryObjectBuilder keyBuilder =
> ignite.binary().builder("SQL_PUBLIC_CITY_9c004c1e_d2d2_
> 4c13_8f38_5f2d266080f6_KEY")
>                 .setField("id", keyValue);
>
>         BinaryObject value = cache.get(keyBuilder.build());
>         if(value!=null) System.out.println("CITY="+value.field("name"));
>         else System.out.println("Empty!!!!!!!!!!!!!!!");
>     }
> -------------------------------------
> CITY=St. Petersburg
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>



-- 
Best regards,
Andrey V. Mashenkov