pyflink.table.table_environment.StreamTableEnvironment.sql_query#
- StreamTableEnvironment.sql_query(query: str) Table#
Evaluates a SQL query on registered tables and retrieves the result as a
Table.All tables referenced by the query must be registered in the TableEnvironment.
A
Tableis automatically registered when its__str__()method is called, for example when it is embedded into a String.Hence, SQL queries can directly reference a
Tableas follows:>>> table = ... # the table is not registered to the table environment >>> table_env.sql_query("SELECT * FROM %s" % table)
- Parameters
query – The sql query string.
- Returns
The result table.