1

I have created a table in ignite using SQLLine and I want to see which columns in that table are the primary key. When i queried SYS.TABLE_COLUMNS I don't see the Primary key columns.Can someone please help me how can i get the primary key columns of already created ignite table. Following is the table i have created and the output of the SYS.TABLE_COLUMNS:

0: jdbc:ignite:thin://127.0.0.1/> CREATE TABLE SUPPLIER (
. . . . . . . . . . . . . . . .)> S_SUPPKEY     INT,
. . . . . . . . . . . . . . . .)> S_NAME        VARCHAR,
. . . . . . . . . . . . . . . .)> S_ADDRESS     VARCHAR,
. . . . . . . . . . . . . . . .)> S_CITY        VARCHAR,
. . . . . . . . . . . . . . . .)> S_NATION      VARCHAR,
. . . . . . . . . . . . . . . .)> S_REGION      VARCHAR,
. . . . . . . . . . . . . . . .)> S_PHONE       VARCHAR, PRIMARY KEY(S_SUPPKEY, S_REGION)) WITH "TEMPLATE=PARTITIONED, AFFINITY_KEY=S_REGION";
No rows affected (0.047 seconds)
0: jdbc:ignite:thin://127.0.0.1/> select * from sys.TABle_COLUMNS;
+-------------+------------+-------------+-----------------+----------------+---------------+----------+-------+-----------+-------+-------------------+
| COLUMN_NAME | TABLE_NAME | SCHEMA_NAME | AFFINITY_COLUMN | AUTO_INCREMENT | DEFAULT_VALUE | NULLABLE |  PK   | PRECISION | SCALE |       TYPE        |
+-------------+------------+-------------+-----------------+----------------+---------------+----------+-------+-----------+-------+-------------------+
| _KEY        | SUPPLIER   | PUBLIC      | false           | false          |               | false    | true  | -1        | -1    |                   |
| _VAL        | SUPPLIER   | PUBLIC      | false           | false          |               | true     | false | -1        | -1    |                   |
| S_SUPPKEY   | SUPPLIER   | PUBLIC      | false           | false          | null          | true     | false | -1        | -1    | java.lang.Integer |
| S_NAME      | SUPPLIER   | PUBLIC      | false           | false          | null          | true     | false | -1        | -1    | java.lang.String  |
| S_ADDRESS   | SUPPLIER   | PUBLIC      | false           | false          | null          | true     | false | -1        | -1    | java.lang.String  |
| S_CITY      | SUPPLIER   | PUBLIC      | false           | false          | null          | true     | false | -1        | -1    | java.lang.String  |
| S_NATION    | SUPPLIER   | PUBLIC      | false           | false          | null          | true     | false | -1        | -1    | java.lang.String  |
| S_REGION    | SUPPLIER   | PUBLIC      | true            | false          | null          | true     | false | -1        | -1    | java.lang.String  |
| S_PHONE     | SUPPLIER   | PUBLIC      | false           | false          | null          | true     | false | -1        | -1    | java.lang.String  |
+-------------+------------+-------------+-----------------+----------------+---------------+----------+-------+-----------+-------+-------------------+
9 rows selected (0.004 seconds)
0: jdbc:ignite:thin://127.0.0.1/> 

As seen from the above output i dont see S_SUPPKEY and S_REGION as primary key instead I see _KEY as primary key

Sachin Janani
  • 1,310
  • 1
  • 17
  • 33

0 Answers0