-
Couldn't load subscription status.
- Fork 18
Add information schema sql reference #847
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+80
−0
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b01889b
Add information schema sql reference
Sevenannn 59f1994
update sql reference
Sevenannn 6d1d2c5
Merge branch 'trunk' into qianqian/doc-info-schema
lukekim 6576bfb
Update website/docs/reference/sql/information_schema.md
Sevenannn e0d6c89
Merge branch 'trunk' into qianqian/doc-info-schema
peasee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| --- | ||
| title: 'Information Schema' | ||
| sidebar_label: 'Information Schema' | ||
| sidebar_position: 4 | ||
| --- | ||
|
|
||
| :::info | ||
| Spice is built on [Apache DataFusion](https://datafusion.apache.org/) and uses the PostgreSQL dialect, even when querying datasources with different SQL dialects. | ||
| ::: | ||
|
|
||
| # Information Schema | ||
|
|
||
| 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. | ||
|
|
||
| ## `SHOW TABLES` | ||
|
|
||
| Use `SHOW TABLES` or query `information_schema.tables` to list the tables in the Spice catalog: | ||
|
|
||
| ```sql | ||
| > show tables; | ||
| or | ||
| > select * from information_schema.tables; | ||
| +---------------+--------------+--------------+------------+ | ||
| | table_catalog | table_schema | table_name | table_type | | ||
| +---------------+--------------+--------------+------------+ | ||
| | spice | runtime | task_history | BASE TABLE | | ||
| | spice | runtime | metrics | BASE TABLE | | ||
| +---------------+--------------+--------------+------------+ | ||
|
|
||
| ``` | ||
|
|
||
| ## `SHOW COLUMNS` | ||
|
|
||
| Use `SHOW COLUMNS` or query `information_schema.columns` to see a table’s column definitions: | ||
|
|
||
| ```sql | ||
| > show columns from t; | ||
| or | ||
| > select table_catalog, table_schema, table_name, column_name, data_type, is_nullable from information_schema.columns; | ||
| +---------------+--------------+--------------+-----------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+ | ||
| | table_catalog | table_schema | table_name | column_name | data_type | is_nullable | | ||
| +---------------+--------------+--------------+-----------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+ | ||
| | spice | runtime | task_history | trace_id | Utf8 | NO | | ||
| | spice | runtime | task_history | span_id | Utf8 | NO | | ||
| | spice | runtime | task_history | parent_span_id | Utf8 | YES | | ||
| | spice | runtime | task_history | task | Utf8 | NO | | ||
| | spice | runtime | task_history | input | Utf8 | NO | | ||
| | spice | runtime | task_history | captured_output | Utf8 | YES | | ||
| | spice | runtime | task_history | start_time | Timestamp(Nanosecond, None) | NO | | ||
| | spice | runtime | task_history | end_time | Timestamp(Nanosecond, None) | NO | | ||
| | spice | runtime | task_history | execution_duration_ms | Float64 | NO | | ||
| | spice | runtime | task_history | error_message | Utf8 | YES | | ||
| | 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 | | ||
| +---------------+--------------+--------------+-----------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+ | ||
| ``` | ||
|
|
||
| ## `SHOW ALL` (configuration options) | ||
|
|
||
| Use `SHOW ALL` or query `information_schema.df_settings` to view current session configuration parameters: | ||
|
|
||
| ```sql | ||
| select * from information_schema.df_settings; | ||
|
|
||
| +-------------------------------------------------------------------------+---------------------------+ | ||
| | name | value | | ||
| +-------------------------------------------------------------------------+---------------------------+ | ||
| | datafusion.catalog.create_default_catalog_and_schema | false | | ||
| | datafusion.catalog.default_catalog | spice | | ||
| | datafusion.catalog.default_schema | public | | ||
| | datafusion.catalog.format | | | ||
| | datafusion.catalog.has_header | true | | ||
| | datafusion.catalog.information_schema | true | | ||
| | datafusion.catalog.location | | | ||
| | datafusion.catalog.newlines_in_values | false | | ||
| | datafusion.execution.batch_size | 8192 | | ||
| ... | ||
| | datafusion.sql_parser.parse_float_as_decimal | false | | ||
| | datafusion.sql_parser.support_varchar_with_length | true | | ||
| +-------------------------------------------------------------------------+---------------------------+ | ||
| ``` | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.