Data Types and Schemas
In this guide, you will explore how to effectively utilize data types and schemas.
Understanding Data Types and Schemas
In Pathway Live Data Framework, data is represented in the form of tables. The structure of each table is defined by a schema, which serves as a blueprint for the data. The schema ensures that the column types are correctly preserved, regardless of variations in the incoming data.
Typically, Pathway Live Data Framework automatically infers the schema, but there are cases where enforcing a specific schema for input proves useful.
Here is a simple example on how to define a schema in Pathway Live Data Framework:
import pathway as pw
class InputSchema(pw.Schema):
colA: int
colB: float
colC: str
Schema Usage in Pathway Live Data Framework
Schemas play an important role in Pathway Live Data Framework by allowing you to declare constraints on tables via input connectors. You can declare the following attributes within a schema:
- Columns: Select the desired columns for your table; any undeclared columns will be ignored by the connectors.
- Columns Types: Define the data type for each column, Pathway Live Data Framework will automatically convert the input data accordingly.
- Primary Keys: Set primary keys to determine the indexes. If no primary keys are defined, indexes will be generated automatically.
- Default values: Specify default values for columns, making it easier to handle missing data.
How to Define and Use a Schema
To create a schema, you need to define a class that inherits from pathway.Schema or pw.Schema, depending on your import.
In the following we will use pw.Schema.
Each column is declared as an attribute of the class. The schema is then passed as a parameter to the input connector:
class InputSchema(pw.Schema):
value: int
table = pw.io.csv.read("./input/", schema=InputSchema)
The above example defines a table with only one column named value of type int.
Defining Multiple Columns
You can declare multiple columns in a schema by simply adding them as attributes to your class:
class MyFirstTwoColumnsSchema(pw.Schema):
colA: int
colB: int
Typing the Columns
To assign data types to columns, simply specify the desired types for the associated attributes in your class:
class TypedSchema(pw.Schema):
colA: int
colB: float
With pw.Schema, you have to type the columns.
If you don't know the type of the input column, you can type the column as typing.Any:
class TypedSchema(pw.Schema):
colA: typing.Any
any is not a Python type but a function.
Be careful to use typing.Any as using any will raise a ValueError.Nested JSON Schemas and Field Access
A column can be annotated with another pw.Schema to validate nested data and
access its fields with their declared types. This works with JSON, JSON cells in
CSV, native BSON and Avro structures, JSON-valued Python/HTTP and SQL inputs,
Debezium, and native structures in Delta Lake and Iceberg. The container is
stored as pw.Json, regardless of its source format; declaring a nested schema
does not introduce a separate dictionary type.
Supported inputs
| Input | Where nested schemas apply |
|---|---|
| JSON Lines, filesystem, S3, MinIO | JSON objects; use format="json" where a format parameter is exposed. |
| Kafka, Redpanda, Pulsar, NATS, MQTT, RabbitMQ, Kinesis | JSON message fields with format="json"; json_field_paths can select a nested object as a column. |
| CSV, filesystem and S3 CSV input | JSON text inside CSV cells, after CSV quoting is decoded. Queue CSV parsers have the delimiter limitation described below. |
| MongoDB | Native BSON documents and arrays, or a whole column containing JSON text. |
| Pulsar Avro | Native records, maps, arrays and nullable unions with format="avro"; also JSON text in Avro string columns. Registry inference can supply the nested schema. |
| Python, HTTP | JSON-valued columns emitted by a Python source, decoded from an HTTP JSON stream, or received in a rest_connector JSON request body. |
| Elasticsearch | Objects in document _source fields, using the same JSON validation and encodings. |
| PostgreSQL, MySQL, MSSQL, SQLite | Columns that the reader decodes as JSON, including JSON/JSONB and supported JSON-text columns. |
| Debezium | JSON objects or JSON text in columns of snapshot, insert, update and delete images. |
| Delta Lake, Iceberg | JSON-text columns and native structs, lists and maps with string keys. |
This is an input validation and field-access feature. It does not change output
formats: writers that encode pw.Json as a string continue to do so. Native
BSON, Avro and data-lake values use the mappings described below; JSON text uses
the JSON encodings in the table of supported leaf types.
Declaring a nested schema
For a JSON Lines file containing
{"list_price": {"value": 59.98}, "current_price": {"value": 49.98}}:
class Price(pw.Schema):
value: float
currency: str = pw.column_definition(default_value="USD")
class Deal(pw.Schema):
list_price: Price
current_price: Price
deals = pw.io.jsonlines.read("deals.jsonl", schema=Deal, mode="static")
prices = deals.select(
value=pw.this.list_price.value,
difference=pw.this.list_price.value - pw.this.current_price.value,
)
Nested schema classes may also be defined inside a function, including with
from __future__ import annotations. The referenced schema must already exist
when the containing schema class is created.
Both columns in deals have type pw.Json. When accessing a declared
field, Pathway uses its schema to extract a typed value: list_price.value above
is a float, so no .as_float() call is needed. Bracket access such as
list_price["value"] has the same typing. Nested objects, lists, and tuples remain
JSON and retain their structure description for further field access.
Dot access also works on JSON columns without a nested schema. In that case,
the result is JSON and the usual .as_float(), .as_int(), .as_str(), and
.as_bool() conversions are still needed. Additional fields and object lookups
with a dynamic key also return JSON, except for maps inferred from the Pulsar
registry: their value type is known for every string key. Use brackets for keys that are not valid
Python identifiers, start with _, or collide with existing expression attributes
such as name, table, get, or str. The .get(key, default) method keeps its
existing JSON return behavior and does not infer a scalar type from the schema.
Nested schemas support bool, int, float, str, None, pw.Json, Any,
the encoded types below, lists, tuples, optional types, and further nested schemas.
For example, list[Price] validates each object in a JSON array and stores the
whole array as pw.Json.
Price | None allows a JSON object or null and produces an optional JSON column.
For JSON input and JSON text inside CSV or BSON strings, encoded fields use the
same representations as top-level JSON connector columns. Native BSON documents
use the BSON mappings described below and are normalized to these JSON encodings:
| Declared type | JSON representation |
|---|---|
bytes | Base64 string, for example "AQI=" for b"\x01\x02" |
pw.DateTimeNaive | Timestamp without a timezone, for example "2026-11-04T12:00:00" |
pw.DateTimeUtc | Timestamp with a timezone, for example "2026-11-04T12:00:00+00:00" |
pw.Duration | Integer number of nanoseconds |
pw.Pointer | Pathway pointer string |
numpy.ndarray with int or float elements | Object with shape and flat elements, for example {"shape": [2], "elements": [1.0, 2.0]} |
pw.PyObjectWrapper | Base64-encoded Pathway serialization, as produced by the JSON writer |
Array annotations must specify int or float elements; bare numpy.ndarray
is not supported inside a nested schema. A declared array dimension is checked.
Pointer and Python object wrapper fields are extracted as generic pw.Pointer
and pw.PyObjectWrapper values; their type parameters are not validated.
Recursive schema definitions, arbitrary unions, and types without a JSON decoder
(such as callables and futures) are not supported.
For example, the following nested.jsonl record contains three levels of fields
and an encoded byte string and array:
{"one": {"two": {"three": 12.5, "content": "AQI=", "vector": {"shape": [2], "elements": [1.0, 2.0]}}}}
import numpy as np
class Details(pw.Schema):
three: float
content: bytes
vector: np.ndarray[tuple[int], np.dtype[np.float64]]
class Envelope(pw.Schema):
two: Details
class NestedInput(pw.Schema):
one: Envelope
table = pw.io.jsonlines.read("nested.jsonl", schema=NestedInput, mode="static")
result = table.select(
details=table.one.two, # pw.Json
price=table.one.two.three, # float
content=table.one.two.content, # bytes
vector=table.one.two.vector, # one-dimensional float ndarray
)
If three is "12.5" instead of 12.5, input validation reports a type error
at /one/two/three. An ordinary pw.Json column without a nested schema accepts
that string and requires an explicit conversion when accessing it.
For example, with two: bytes declared inside the schema of one,
table.select(data=table.one.two) produces a bytes column. The original
table.one remains JSON and retains the base64 string. Input validation checks
that the string can be decoded; field access decodes it again, without caching
the decoded value in the JSON object. To reuse decoded data, select it into a
typed column and use that column in subsequent expressions. The same behavior
applies to other encoded types, including arrays and wrapped Python objects.
An optional scalar or a field accessed through an optional object produces an
optional result: a null parent gives None. List indexing also produces an
optional typed value, since an out-of-bounds JSON index yields null. Fixed-length
tuples support typed access at a constant, nonnegative index. A constant index
outside the declared tuple length is rejected.
Structure descriptions survive selecting, renaming, filtering, and joining columns. When combining tables or conditional expressions, they are retained only if all possible inputs have matching descriptions. Arbitrary JSON transformations, such as a UDF that returns JSON, discard the description; their fields use ordinary JSON access and explicit conversions again.
Validation, defaults and errors
Fields are required unless they have a default_value. An optional type permits
an explicit null; it does not make a missing field optional. Missing fields with
defaults are inserted into the resulting JSON object. Explicit null values are
checked against the declared type and are never replaced by defaults. Additional
fields are preserved. Integer JSON numbers are accepted for float fields;
strings containing numbers are not converted.
Invalid nested objects use the connector's normal parsing-error handling: the
affected column becomes an error value, and the error reports the nested field
path. You can use deals.remove_errors() to discard rows containing error values.
Defaults are checked when the input connector is constructed.
Fields inside a nested schema cannot declare primary keys or select the message key as their source.
JSON columns from Python, HTTP, SQL and Debezium
For Python sources, pass a JSON-compatible dictionary/list or pw.Json value;
encoded leaves must already use the JSON representations above (for example,
base64 strings for bytes, not Python bytes embedded in a dictionary). SQL readers
first decode their JSON/JSONB or JSON-text columns using their normal rules, then
validate the resulting JSON. A nested schema does not change the source's column
existence checks or convert arbitrary SQL types into JSON. The API references
linked in the supported-input table include examples for each reader.
pw.io.debezium.read also validates nested columns in snapshot, insert, update
and delete images. It accepts native JSON objects or JSON text in the column
(as emitted for PostgreSQL JSON/JSONB). Only the column root is decoded as JSON
text; strings inside it keep their meaning. MongoDB key-only deletes do not
require a value image.
Native structures in Delta Lake and Iceberg
Delta Lake and Iceberg accept JSON stored in string columns and native
structs, lists and maps with string keys. Struct fields are matched by name,
independently of their physical order; tuple annotations use field positions. Native binary leaves become base64;
native timestamps/dates become ISO strings; durations stored as integers use
microseconds, as for ordinary data-lake columns. Native numeric lists can be
read as ndarrays; their rectangular shape is inferred (or supplied by the
usual shape/elements struct). Non-string or duplicate map keys, non-finite
numbers, ragged arrays and out-of-range temporal values produce errors.
Undeclared fields are preserved. Plain pw.Json columns also accept these
native containers, without typed access or nested validation. Defaults and validation apply to retractions
as well as insertions; key-only upsert deletions keep their existing behavior.
For example, an external Delta Lake or Iceberg table can have a native
payload: struct<price: double, content: binary> column:
class LakePayload(pw.Schema):
price: float
content: bytes
currency: str = pw.column_definition(default_value="USD")
class LakeInput(pw.Schema):
key: int = pw.column_definition(primary_key=True)
payload: LakePayload
records = pw.io.deltalake.read("./nested_delta", schema=LakeInput, mode="static")
result = records.select(price=records.payload.price, content=records.payload.content)
The same schema works with pw.io.iceberg.read. Reading records.payload
returns JSON containing the base64 representation of the binary leaf; reading
records.payload.content decodes it to bytes. The source column names and types
still need to be compatible with the connector's normal input rules.
JSON cells in CSV input
For example, this CSV contains a JSON object in its list_price field:
number,list_price
1,"{""value"":59.98}"
class CsvDeal(pw.Schema):
number: int
list_price: Price
deals = pw.io.csv.read("deals.csv", schema=CsvDeal, mode="static")
prices = deals.select(value=deals.list_price.value) # float
The filesystem CSV reader handles CSV quoting before the field's JSON is parsed
and validated.
Nested defaults, encoded values such as bytes and numeric arrays, and typed field
access work as they do for JSON input. Validation errors include the full nested
path, for example /list_price/value.
An empty CSV field uses its column default when one is declared. Otherwise, it is
accepted only for an optional nested schema and produces None. An explicit JSON
null also produces None for an optional nested schema, and is an error for a
required one; it never selects the column default. Optional nested schemas also
accept CSV's other null markers, such as None and case-insensitive NULL.
Ordinary CSV columns declared as pw.Json without a nested schema retain their
existing parsing rules, including the distinction between JSON null and None.
Message connectors that use the raw CSV parser retain its simple delimiter
splitting: CSV quoting does not protect delimiters inside a JSON value on that
path. The filesystem example above uses the CSV-aware reader. For JSON objects
containing delimiters in queue messages, use format="json".
Nested schemas in MongoDB BSON input
pw.io.mongodb.read accepts a nested schema for a native BSON document or array,
or for a BSON string containing a JSON value. The latter is the representation
that pw.io.mongodb.write produces when writing a pw.Json column.
For native BSON documents, declared fields use the MongoDB connector's type conversions before being stored in the JSON encodings above:
| Declared type | Native BSON input |
|---|---|
bool, int, float, str | Corresponding BSON scalar; integers are also accepted for float |
bytes | BSON Binary, including non-generic binary subtypes; the subtype is not retained |
pw.DateTimeNaive, pw.DateTimeUtc | BSON DateTime, with millisecond precision |
pw.Duration | BSON Int64 milliseconds, normalized to JSON nanoseconds |
pw.Pointer | Pathway pointer string |
Numeric numpy.ndarray | Rectangular BSON arrays, normalized to shape and elements |
pw.PyObjectWrapper | BSON Binary containing Pathway's serialized wrapper |
str | Also ObjectId as hex, Decimal128 as a decimal string, and regular expressions as /pattern/options |
int | Also BSON Timestamp's seconds component; its increment is discarded |
pw.Json, Any, undeclared fields | Ordinary BSON-to-JSON conversion, without typed normalization of their contents |
A native BSON Binary declared as bytes therefore becomes a base64 string in
the stored JSON, while table.payload.content returns bytes. A BSON date
becomes a timestamp string, and a declared ndarray becomes a JSON object with
its shape and flat elements. Access decodes these representations as for JSON
input. BSON type tags are not preserved for normalized declared fields.
Opaque JSON leaves preserve strings as strings, including strings that look like JSON text; only a string containing the whole column is parsed as JSON text.
Native arrays must have consistent nesting depth and lengths. Their rank must
match the annotation when specified; an unspecified rank is inferred. A
zero-dimensional ndarray uses a BSON numeric scalar. With any other declared
rank, or an unspecified rank, a numeric scalar follows the existing MongoDB
conversion to a one-element, one-dimensional array, subject to the rank check.
An empty outer BSON array only supplies a one-dimensional shape; use JSON text
with an explicit shape when an empty array needs additional dimensions.
Non-finite declared floats or float-array elements are rejected because the stored JSON encoding cannot
represent them.
Within native BSON documents, a base64 string is not a substitute for Binary
when the field is declared as bytes, and a timestamp string is not a BSON
DateTime. If the whole column is a BSON string containing JSON, all its
fields instead follow the JSON encoding table above. This distinction enables
roundtrips through the MongoDB writer without guessing encodings for native fields.
Missing fields, including the column itself, require a default even when their
type is optional. Explicit BSON null is allowed only where the schema permits
it and never selects a default. Defaults use Python values and the same JSON
normalization and validation as other nested schemas. Invalid data produces an
error value with the full path, such as /payload/content; remove_errors() can
discard affected rows. Ordinary MongoDB columns without a nested schema keep
their existing missing-field and conversion behavior.
For example, insert this document using mongosh:
use shop
db.nested_orders.insertOne({payload: {price: 12.5, content: BinData(0, "AQI=")}})
class Payload(pw.Schema):
price: float
content: bytes
currency: str = pw.column_definition(default_value="USD")
class MongoOrder(pw.Schema):
payload: Payload
orders = pw.io.mongodb.read(
"mongodb://localhost:27017/?replicaSet=rs0",
database="shop", collection="nested_orders", schema=MongoOrder, mode="static",
)
result = orders.select(
price=orders.payload.price, # float: 12.5
content=orders.payload.content, # bytes: b"\x01\x02"
currency=orders.payload.currency, # str: "USD"
)
Writing orders back to MongoDB stores payload as a JSON string containing
base64 data, not as a native BSON document with Binary. Reading it again with
MongoOrder recovers the same typed fields. To write a native BSON binary field,
extract it into a bytes column before writing.
Nested schemas in Avro input
pw.io.pulsar.read(..., format="avro", schema=...) accepts nested schema
annotations for Avro records, maps, arrays, and nullable unions. Containers stay
pw.Json, and declared leaves support typed dot and bracket access. With explicit nested annotations, maps are
validated as objects with the declared field names; dynamic keys retain ordinary
JSON access. Registry-inferred maps instead describe the type of every value,
as explained below. An Avro union's selected value must match the declared Pathway type.
Native Avro leaves are normalized before storing the JSON container:
| Declared type | Native Avro input |
|---|---|
bool, int, float, str | Corresponding scalars; int/long also convert to float |
bytes | bytes or fixed, stored as base64 |
pw.DateTimeUtc | timestamp-millis, timestamp-micros, timestamp-nanos, stored as a timestamp string |
pw.DateTimeNaive | date or local-timestamp-millis/micros/nanos, stored as a timestamp string |
pw.Duration | long or time-micros in microseconds, or time-millis in milliseconds; stored in nanoseconds |
pw.Pointer | Pathway pointer string |
Numeric numpy.ndarray | Rectangular numeric Avro arrays, stored as shape and elements; a numeric scalar represents a zero-dimensional array |
pw.PyObjectWrapper | bytes or fixed containing Pathway's serialized wrapper, stored as base64 |
str | Also enum symbols, UUIDs and decimal values rendered as strings |
pw.Json, Any, undeclared fields | Ordinary structural Avro-to-JSON conversion; logical time values remain numbers and binary values become base64 |
Calendar-based Avro duration does not map to pw.Duration; use an opaque JSON
field to retain its months, days and milliseconds. Declared arrays require
consistent lengths and nesting depth, numeric element types, and the specified
rank. Empty outer arrays cannot convey additional inner dimensions. Non-finite
numbers and values outside the supported timestamp/duration range produce errors.
These nested input mappings do not add support for standalone ndarray or Python
object wrapper columns to the Avro writer. They can be written inside JSON columns.
With an explicit nested schema, missing fields, including whole columns missing
from an older writer schema, require a Pathway default even when optional. Explicit nulls never select a
default. Additional fields are preserved. Defaults are checked before reading,
and row errors include full paths such as /payload/items/0/price.
table.remove_errors() can discard rows containing errors. The connector decodes
each message using its writer schema version and then applies the Pathway schema;
it does not insert newer writer-schema defaults into older messages.
An Avro column declared as string or a nullable string may contain JSON text.
Such columns use the JSON encoding table, including nanosecond durations and
explicit ndarray shapes. This is how Pathway's Avro writer stores JSON columns,
so writing and rereading with the same nested schema restores typed access.
Strings inside native records, or string branches of a wider union, remain
strings rather than being interpreted as JSON text.
For a registered Avro record whose payload is a record with price: double
and content: bytes:
class Payload(pw.Schema):
price: float
content: bytes
currency: str = pw.column_definition(default_value="USD")
class Input(pw.Schema):
payload: Payload
orders = pw.io.pulsar.read(
"pulsar://localhost:6650", "nested-orders",
format="avro", schema=Input, mode="static",
)
result = orders.select(price=orders.payload.price, content=orders.payload.content)
The source's registered Avro schema is still needed to decode native records.
A nested pw.Schema describes validation, not the complete Avro binary layout.
Without a message schema version, the existing explicit-schema fallback expects
JSON columns encoded as Avro strings; it cannot infer a foreign record layout.
With schema=None, the connector infers nested metadata from the registry's
latest schema. Records and maps, including arrays containing them, become JSON
columns with typed field access. Named type references are resolved. For the
native Avro topic above, no Pathway schema declaration is needed:
inferred = pw.io.pulsar.read(
"pulsar://localhost:6650", "nested-orders",
format="avro", schema=None, mode="static",
)
inferred_result = inferred.select(
price=inferred.payload.price, # float
content=inferred.payload.content, # bytes
)
Inferred maps validate every value against the registry's value type. Both
table.prices[table.key] and table.prices.USD return that type, made optional
because a key may be absent. Nested records and arrays retain their metadata
after projection. Top-level arrays of scalar values keep their existing native
list type; arrays inside a JSON record stay JSON with typed element access.
Representable registry defaults become Pathway defaults, including defaults for nested fields and columns absent from older messages. Binary defaults are converted to base64; Avro logical time defaults use their declared units. Optional fields still require a default when absent. Inferred recursive edges and unions with several non-null branches remain opaque JSON: access below them uses the ordinary JSON conversions. The finite part of a recursive record is still typed. JSON text stored in an Avro string has no inferable inner structure and requires an explicit nested schema.
Inference also works for Pulsar JSON registry schemas. Their logical time types remain integers, matching JSON payloads rather than Avro binary units.
Migrating code that uses Pulsar registry inference
With schema=None, declared scalar fields now return typed values. For example,
replace table.payload.price.as_float() with table.payload.price when the
registry declares price as a floating-point number. Top-level arrays of records
or maps now have type pw.Json with nested metadata; top-level arrays of scalars retain
their native list type. JSON array indexing returns an optional value and does
not support Python-style negative indexing.
To retain untyped record/map access and skip nested validation, pass an explicit
schema such as pw.schema_from_types(payload=pw.Json) (include the other input
columns as needed). To remove the nested declaration from an existing schema,
use Input.with_types(payload=pw.Json).
Field access decodes encoded leaves on use, just as for JSON, CSV and BSON. This metadata is stored once per table column; there is no new engine container type.
Defining Primary Keys
To designate primary keys, use the column_definition function and the primary_key parameter:
class PrimarySchema(pw.Schema):
colA: int = pw.column_definition(primary_key=True)
colB: float
In this example, the index will be based on the colA column.
You can select multiple columns to be a part of primary key:
class MultiplePrimarySchema(pw.Schema):
colA: int = pw.column_definition(primary_key=True)
colB: float
colC: str = pw.column_definition(primary_key=True)
Defining Default Values
Similar to primary keys, you can set default values using the column_definition function and the default_value parameter:
class DefaultValueSchema(pw.Schema):
colA: int = pw.column_definition(default_value=0)
colB: float
colC: str = pw.column_definition(default_value="Empty")
Inline Schemas Definitions
When it may not be practical to define a class, when automating schema definitions for example, The Pathway Live Data Framework offers alternative approaches using inline schema definition.
Schema from Dictionary
You can define a schema using a dictionary through the schema_builder function.schema_builder takes as argument a parameter columns which is a dictionary that maps column names to column definitions created using the column_definition function.
The dtype parameter of column_definition is used to specify the types, if not provided it defaults to typing.Any.
Additionally, if desired, you can assign a name to the schema using the optional name parameter.
schema = pw.schema_builder(columns={
'key': pw.column_definition(dtype=int, primary_key=True),
'data': pw.column_definition(dtype=int, default_value=0)
}, name="my_schema")
This resulting schema is equivalent to the following class-based schema:
class InputSchema(pw.Schema):
key: int = pw.column_definition(primary_key=True)
data: int = pw.column_definition(default_value=0)
With schema_builder, defining the type is optional. The default type is typing.Any:
schema = pw.schema_builder(columns={
'key': pw.column_definition(dtype=int, primary_key=True),
'data': pw.column_definition()
}, name="my_schema")
table = pw.io.csv.read("./input/", schema=schema)
print(table.typehints())
{'key': <class 'int'>, 'data': <class 'typing.Any'>}
Schema from Types
For the simple cases where you only need to define types and not default values nor primary keys, you can use schema_from_types.
schema_from_types simply takes the types as field=type kwargs:
schema = pw.schema_from_types(key=int, data=int)
This resulting schema is equivalent to the following class-based schema:
class InputSchema(pw.Schema):
key: int
data: int
Accessing Table Types
During debugging, you may need to assess the schema of a table.
You can achieve this by printing its typehints:
print(table.typehints())
This will display the data types of each column in the table. For example:
{'age': <class 'int'>, 'owner': <class 'str'>, 'pet': <class 'str'>}
You can also print the schema of a single column by using schema:
print(table.schema['age'])
<class 'int'>
Type Casting an Existing Table
You can also want to cast the data of an existing table.
This can be done using cast:
table = table.select(value = pw.cast(int, pw.this.value))
This will cast the values of the column value to int.
Typing a Column Created with apply
If Pathway fails to infer the correct column's type created with apply,
you can enforce the resulting type with apply_with_type:
table = table.select(
value = pw.apply_with_type(lambda x: int(x)+1, int, pw.this.value)
)
This will cast the values to integers and increment each value by one,
resulting in the value column being of type int.
This is only a workaround since the framework should be able to correctly infer your data type.
Conclusions
Mastering data types and schemas is essential for effectively managing Tables. By leveraging schemas, you can define the structure of your tables, improving the efficiency of your data pipeline. If you encounter typing issues, please contact us on discord, so we can help you.