Ctrl+K
Logo image Logo image

Site Navigation

  • API Reference
  • Examples

Site Navigation

  • API Reference
  • Examples

Section Navigation

  • PyFlink Table
    • TableEnvironment
    • Table
    • Data Types
    • Window
    • Expressions
    • User Defined Functions
    • Descriptors
    • StatementSet
    • Catalog
  • PyFlink DataStream
  • PyFlink Common

pyflink.table.schema.Schema.Builder.column_by_expression#

Builder.column_by_expression(column_name: str, expr: Union[str, Expression]) → Builder#

Declares a computed column that is appended to this schema.

Computed columns are virtual columns that are generated by evaluating an expression that can reference other columns declared in the same table. Both physical columns and metadata columns can be accessed. The column itself is not physically stored within the table. The column’s data type is derived automatically from the given expression and does not have to be declared manually.

Computed columns are commonly used for defining time attributes. For example, the computed column can be used if the original field is not TIMESTAMP(3) type or is nested in a JSON string.

Example:

>>> Schema.new_builder() \
...     .column_by_expression("ts", "orig_ts - INTERVAL '60' MINUTE") \
...     .column_by_metadata("orig_ts", DataTypes.TIMESTAMP(3), "timestamp")
Parameters
  • column_name – Column name

  • expr – Computation of the column

previous

pyflink.table.schema.Schema.Builder.column

next

pyflink.table.schema.Schema.Builder.column_by_metadata

On this page
  • Builder.column_by_expression()
Show Source

Created using Sphinx 5.3.0.