DESCRIBE
Returns an analytical description of the table. For examples, see Examples.
Syntax​
DESCRIBE { database_name | database_name.blockchain_name }
[<describe_modifier>]
<describe_modifier> ::= ALL | SCHEMA | DATA {CATEGORICAL | NUMERIC} | HISTOGRAM
Arguments​
database_name
Is the name of the database to describe, if no blockchain is specified, all blockchains in the database are described.
blockchain_name
The name of the blockchain that you would like to describe.
ALL
describe_modifier
Returns a description of the data, schema, and histogram of each blockchain being described.
SCHEMA
describe_modifier
Returns a decryption of the schema specified for each blockchain being described.
DATA CATAGORICAL
describe_modifier
Returns an analytical decryption of the distribution of categorical data (columns of type STRING) stored in each of the specified blockchains.
If there is no categorical data, categorical columns will not appear in the response.
DATA NUMERIC
describe_modifier
Returns an analytical decryption of the distribution numeric data stored in each of the specified blockchains.
If there is no numeric data, numeric columns will not appear in the response.
HISTOGRAM
describe_modifier
Returns a description of the histograms, used to optimize query plans, currently built on each blockchain being described.
[IMPORTANT] HISTOGRAM and ALL descriptions aren't currently supported.
Permissions​
READ
permission required on the database or blockchain target.
READ
permissions default to members of the admin fixed database role. Members of the admin role can transfer permissions to other users.
Examples​
Category | Featured syntax elements |
---|---|
Describing Data | DATA |
Describing Schema | SCHEMA |
Describing Histogram | HIST |
Describing Data​
Examples in this section demonstrate using the Describe statement to describe numerical data stored in a blockchain.
A. Describing numerical data.​
The following example returns a numerical description of the data stored in the products
table in the main
database. Only a numerical description is returned
because the blockchain only stores numerical data.
CREATE BLOCKCHAIN main.products (price float64, units_sold int64);
INSERT main.products VALUES (2.50, 20), (9.99, 0), (3.25, 18), (39.99, 53), (50.00, 5), (6.99, 15), (7.99, 0);
DESCRIBE main.products DATA NUMERIC;
OUTPUT​
stats_main products numerical stats profile: 2019-10-16 10:27:47.623745 | BLOCKCHAIN_NAME | COLUMNS | COUNT | MEAN | SD | MIN | MAX | 25% | 50% | 75% | |-------|-------|---------|------|---|---|---|---|---|---| |products| price |7|17.244285714285713|17.916294145787166|2.5|50|5.150787165879375|17.244285714285713|29.33778426269205| |products|uints_sold|7|15.857142857142858|16.9993997493068|0|53|4.382548026360714|15.857142857142858|27.331737687925|
B. Describing categorical data.​
The following example returns a categorical description of the data stored in the dogs
table in the main
database. Only a categorical description is returned
because the blockchain only stores categorical data, in this case strings.
DESCRIBE main.dogs DATA CATEGORICAL;
OUTPUT​
stats_main dogs categorical stats profile: 2019-10-16 11:07:44.724438 | BLOCKCHAIN_NAME | COLUMNS | UNIQUE | TOP | FREQ | COUNT |-------|-------|---------|------|---|---| |dogs| name | 125 | doge | 23 | 150 | |dogs| location | 5 | the dog park | 120 | 150 |
Describing Schema​
This example demonstrate using the Describe statement to describe the schema of a blockchain.
Describing schema.​
The employees
table is stored in the main
database and stores first_name
, last_name
, and position
.
DESCRIBE main.employees SCHEMA;
OUTPUT​
BLOCKCHAIN_NAME | BLOCKCHAIN_TYPE | COLUMN_NAME | DATA_TYPE | SIZE | PACKED | CONSTRAINT | COMPOSITION | MASK |
---|---|---|---|---|---|---|---|---|
employees | TRADITIONAL | name | STRING | 255 | true | PRIMARY KEY | TRADITIONAL | NO MASK |
employees | TRADITIONAL | STRING | 255 | true | UNIQUE | TRADITIONAL | NO MASK |
Describing Histogram​
This feature is yet to be implemented yet.