Skip to main content
GuideServerConfigure and deploy Tabsdata servers on your machine.TutorialsConfigure data integration workflows within a running Tabsdata server.Advanced TutorialsBuild end-to-end workflows between two specific systems.API ReferenceCLI ReferenceRelease Notes
Version: 2.0.0

ColumnDefinition

class
class ColumnDefinition(name: str | None = None, dtype: ColumnDataType = String)

Categories: projection, string

The column one Grok capture produces: its name and data type.

One of these per capture makes up the schema passed to TableFrame.grok, keyed by capture name. The captured text is parsed into dtype; a row that does not match leaves the column null.

Examples

tf.grok(
"logs",
r"%{WORD:user}-%{INT:year}",
{
"user": ColumnDefinition("user", String),
"year": ColumnDefinition("year", Int64),
},
)

A name that differs from the capture renames the column it produces -- here the user capture lands in a column called who:

tf.grok(
"logs",
r"%{WORD:user}-.*",
{"user": ColumnDefinition("who", String)},
)

Parameters

parameter
namestr | None

Name of the column to add. None (the default) keeps the capture's own name, and any other value renames it.

parameter
dtypeColumnDataType (DataType | DataTypeClass)

Data type the captured text is parsed into, from tabsdatak.tableframe.datatypes -- a type (Int64) or an instance where it is parameterized (Datetime("us")). Defaults to String, which keeps the text as captured.