ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Sham <peter_s...@yahoo.com>
Subject Re: How to get the column names(or fieldsNames) of existing ignite sql table
Date Sat, 17 Nov 2018 13:43:28 GMT
Hello,

I don't think you can get all the tables created in a cache by SQL. I'm learning this stuff
and hit the same questions and figure I can find it out by the following steps in code (I'm
coding c# and don't know if the methods apply in Java).
Get all cache names from IIgnite by GetCachenames()

Loop through all the caches in getting them one by one by IIgnite.GetCache<object, object>()

Get the cache configuration by GetConfiguration on IICache

Loop through QueryEntities on cache configuration

Each QueryEntity would hold the table name, even with those created by SQL.

In fact, within QueryEntity you will have Fields which are the columns.

And for question 2, I think, yes, from my learning, SQL Create Table always create another
cache with default naming like SQL_PUBLIC_<table name>. But according to manual, you
can override the name by supplying options after "with".
Happy Coding!

Peter Sham
sham.peter@gmail.com (https://link.getmailspring.com/link/1542461644.local-9c4bedcc-4679-v1.5.2-31660462@getmailspring.com/0?redirect=mailto%3Asham.peter%40gmail.com&recipient=dXNlckBpZ25pdGUuYXBhY2hlLm9yZw%3D%3D)

On Nov 17 2018, at 5:42 am, Dmitry Lazurkin <dilaz03@gmail.com> wrote:
>
> Hello.
> On 17.11.2018 13:25, siva wrote:
> > Quetions:
> > =======
> > 1.How to get the existing table columnNames ?
> >
> > i am trying to use this query but its throwing exception
> > *select COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS where
> > TABLE_NAME='Person'*
>
>
> You need query with setLocal(true). I don't known how to do this with
> thin client.
>


Mime
View raw message