pyflink.table.table_environment.TableEnvironment.sql_query#
- TableEnvironment.sql_query(query: str) pyflink.table.table.Table [source]#
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
Table
is automatically registered when its__str__()
method is called, for example when it is embedded into a String.Hence, SQL queries can directly reference a
Table
as 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.