TabularSchema
represents the schema information associated with a Tabular object.
TabularSchema[tab]
extracts the schema information for the tabular object tab.
TabularSchema[schema,"prop"val]
modifies the existing TabularSchema object schema with the new value val for the property "prop".
TabularSchema[schema,"prop1"val1,… >]
modifies multiple properties.
Details
- TabularSchema is typically used to report, set or modify metadata, such as column names and types, in a Tabular object.
- Tabular[data,schm] sets or modifies the schema of the tabular data, where schm is given as a TabularSchema object or an association <"prop1"val1,… >.
- For a Tabular object tab with schema TabularSchema[…], some of the stored properties apply to the whole tab, while others pertain to each column of tab.
- TabularSchema[…]["prop"] accesses properties that pertain to the whole tabular, including:
-
"Columns" list of column names or indices "ColumnKeys" list of column keys or None "ColumnTypes" element types of the columns "KeyColumns" set of columns that uniquely identify rows in the tabular "Backend" backend supporting the data "DefaultColumnBaseName" prefix used to construct named columns from anonymous ones automatically "ColumnProperties" list or association containing all column properties "Properties" list of all global property names - TabularSchema[schema,"globalprop"val] can be used to changed global properties, such as the ones outlined in the table above.
- TabularSchema[…][col,"prop"] accesses properties that pertain to the column col, including:
-
"ElementType" type specification for the elements of the column "Nullable" whether the column can accept missing values "Properties" list of all column-level property names - TabularSchema[schema,"columnprop"<"col1"val1,… >] can be used to change some of the column-level properties outlined in the table above.
- In TabularSchema[schema,<"prop1"…,… >], the properties are set in the order given.
Examples
open allclose allBasic Examples (3)
Get the schema of a Tabular object:
Extract global information from the schema:
Extract information about a column:
Take a schema for Tabular objects with given column names and types:
TabularSchema can be used as a second argument to Tabular to change the schema information:
Scope (19)
"ColumnKeys" (6)
Use "ColumnKeys" to set the names of columns:
This can also be performed specifying the column keys directly in the second argument of Tabular:
The property "ColumnKeys" returns None for Tabular objects without column keys:
Column keys can be unset using None:
This can also be performed specifying None directly in the second argument of Tabular:
Columns can be automatically named by setting "ColumnKeys" to Automatic:
When naming columns, if insufficient keys are given, the others will be named automatically:
The same thing happens with direct specification of column keys in Tabular:
The default column prefix can be changed by using "DefaultColumnBaseName":
"ColumnTypes" (2)
"KeyColumns" (4)
Set the key columns of a tabular:
If the tabular has no column keys, the key columns can be set by indices:
When a tabular has no column keys, the value of the corresponding property is None:
A column with duplicates cannot be used as the "KeyColumns" value of a tabular:
"Backend" (3)
Get the backend property of an in-memory tabular:
Get the backend property of a SQL-backed tabular:
The backend property is used during type validation:
A newly created schema may not specify a backend:
In this case, type validation cannot be performed:
Once the backend is specified, invalid types can be rejected:
"DefaultColumnBaseName" (3)
Properties & Relations (2)
TabularSchema can be used as the second argument in Tabular:
The same result can be achieved using an elided form of the same schema when all the other properties can be inferred from the data:
TabularSchema can be used to change the types of a Tabular object:
Use CastColumns instead:
Text
Wolfram Research (2025), TabularSchema, Wolfram Language function, https://reference.wolfram.com/language/ref/TabularSchema.html.
CMS
Wolfram Language. 2025. "TabularSchema." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/TabularSchema.html.
APA
Wolfram Language. (2025). TabularSchema. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TabularSchema.html