|
| 1 | +--- |
| 2 | +title: 'Information Schema' |
| 3 | +sidebar_label: 'Information Schema' |
| 4 | +sidebar_position: 4 |
| 5 | +--- |
| 6 | + |
| 7 | +:::info |
| 8 | +Spice is built on [Apache DataFusion](https://datafusion.apache.org/) and uses the PostgreSQL dialect, even when querying datasources with different SQL dialects. |
| 9 | +::: |
| 10 | + |
| 11 | +# Information Schema |
| 12 | + |
| 13 | +Spice supports display metadata about available tables and views. This information is accessible through the ISO SQL `information_schema` schema or the `SHOW TABLES` and `SHOW COLUMNS` commands. |
| 14 | + |
| 15 | +## `SHOW TABLES` |
| 16 | + |
| 17 | +Use `SHOW TABLES` or query `information_schema.tables` to list the tables in the Spice catalog: |
| 18 | + |
| 19 | +```sql |
| 20 | +> show tables; |
| 21 | +or |
| 22 | +> select * from information_schema.tables; |
| 23 | ++---------------+--------------+--------------+------------+ |
| 24 | +| table_catalog | table_schema | table_name | table_type | |
| 25 | ++---------------+--------------+--------------+------------+ |
| 26 | +| spice | runtime | task_history | BASE TABLE | |
| 27 | +| spice | runtime | metrics | BASE TABLE | |
| 28 | ++---------------+--------------+--------------+------------+ |
| 29 | + |
| 30 | +``` |
| 31 | + |
| 32 | +## `SHOW COLUMNS` |
| 33 | + |
| 34 | +Use `SHOW COLUMNS` or query `information_schema.columns` to see a table’s column definitions: |
| 35 | + |
| 36 | +```sql |
| 37 | +> show columns from t; |
| 38 | +or |
| 39 | +> select table_catalog, table_schema, table_name, column_name, data_type, is_nullable from information_schema.columns; |
| 40 | ++---------------+--------------+--------------+-----------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+ |
| 41 | +| table_catalog | table_schema | table_name | column_name | data_type | is_nullable | |
| 42 | ++---------------+--------------+--------------+-----------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+ |
| 43 | +| spice | runtime | task_history | trace_id | Utf8 | NO | |
| 44 | +| spice | runtime | task_history | span_id | Utf8 | NO | |
| 45 | +| spice | runtime | task_history | parent_span_id | Utf8 | YES | |
| 46 | +| spice | runtime | task_history | task | Utf8 | NO | |
| 47 | +| spice | runtime | task_history | input | Utf8 | NO | |
| 48 | +| spice | runtime | task_history | captured_output | Utf8 | YES | |
| 49 | +| spice | runtime | task_history | start_time | Timestamp(Nanosecond, None) | NO | |
| 50 | +| spice | runtime | task_history | end_time | Timestamp(Nanosecond, None) | NO | |
| 51 | +| spice | runtime | task_history | execution_duration_ms | Float64 | NO | |
| 52 | +| spice | runtime | task_history | error_message | Utf8 | YES | |
| 53 | +| spice | runtime | task_history | labels | Map(Field { name: "entries", data_type: Struct([Field { name: "keys", data_type: Utf8, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }, Field { name: "values", data_type: Utf8, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }]), nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }, false) | NO | |
| 54 | ++---------------+--------------+--------------+-----------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+ |
| 55 | +``` |
| 56 | + |
| 57 | +## `SHOW ALL` (configuration options) |
| 58 | + |
| 59 | +Use `SHOW ALL` or query `information_schema.df_settings` to view current session configuration parameters: |
| 60 | + |
| 61 | +```sql |
| 62 | +select * from information_schema.df_settings; |
| 63 | + |
| 64 | ++-------------------------------------------------------------------------+---------------------------+ |
| 65 | +| name | value | |
| 66 | ++-------------------------------------------------------------------------+---------------------------+ |
| 67 | +| datafusion.catalog.create_default_catalog_and_schema | false | |
| 68 | +| datafusion.catalog.default_catalog | spice | |
| 69 | +| datafusion.catalog.default_schema | public | |
| 70 | +| datafusion.catalog.format | | |
| 71 | +| datafusion.catalog.has_header | true | |
| 72 | +| datafusion.catalog.information_schema | true | |
| 73 | +| datafusion.catalog.location | | |
| 74 | +| datafusion.catalog.newlines_in_values | false | |
| 75 | +| datafusion.execution.batch_size | 8192 | |
| 76 | +... |
| 77 | +| datafusion.sql_parser.parse_float_as_decimal | false | |
| 78 | +| datafusion.sql_parser.support_varchar_with_length | true | |
| 79 | ++-------------------------------------------------------------------------+---------------------------+ |
| 80 | +``` |
0 commit comments