当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Python pyflink TableResult.get_table_schema用法及代码示例


本文简要介绍 python 语言中 pyflink.table.TableResult.get_table_schema 的用法。

用法:

get_table_schema() → pyflink.table.table_schema.TableSchema

获取结果的架构。

DDL、USE、EXPLAIN 的架构:

+-------------+-------------+----------+
| column name | column type | comments |
+-------------+-------------+----------+
| result      | STRING      |          |
+-------------+-------------+----------+

SHOW的架构:

+---------------+-------------+----------+
|  column name  | column type | comments |
+---------------+-------------+----------+
| <object name> | STRING      |          |
+---------------+-------------+----------+
The column name of `SHOW CATALOGS` is "catalog name",
the column name of `SHOW DATABASES` is "database name",
the column name of `SHOW TABLES` is "table name",
the column name of `SHOW VIEWS` is "view name",
the column name of `SHOW FUNCTIONS` is "function name".

DESCRIBE 的架构:

+------------------+-------------+-------------------------------------------------+
| column name      | column type |                 comments                        |
+------------------+-------------+-------------------------------------------------+
| name             | STRING      | field name                                      |
+------------------+-------------+-------------------------------------------------+
| type             | STRING      | field type expressed as a String                |
+------------------+-------------+-------------------------------------------------+
| null             | BOOLEAN     | field nullability: true if a field is nullable, |
|                  |             | else false                                      |
+------------------+-------------+-------------------------------------------------+
| key              | BOOLEAN     | key constraint: 'PRI' for primary keys,         |
|                  |             | 'UNQ' for unique keys, else null                |
+------------------+-------------+-------------------------------------------------+
| computed column  | STRING      | computed column: string expression              |
|                  |             | if a field is computed column, else null        |
+------------------+-------------+-------------------------------------------------+
| watermark        | STRING      | watermark: string expression if a field is      |
|                  |             | watermark, else null                            |
+------------------+-------------+-------------------------------------------------+

INSERT 的模式:(每个接收器一列)

+----------------------------+-------------+-----------------------+
| column name                | column type | comments              |
+----------------------------+-------------+-----------------------+
| (name of the insert table) | BIGINT      | the insert table name |
+----------------------------+-------------+-----------------------+

SELECT 的架构是选定的字段名称和类型。

返回:

结果的架构。

返回类型:

pyflink.table.TableSchema

版本 1.11.0 中的新函数。

相关用法


注:本文由纯净天空筛选整理自apache.org大神的英文原创作品 pyflink.table.TableResult.get_table_schema。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。