OpenBI Docs Buy

Table.Schema

A table that describes a table's columns: a row per column with its name, place, type and whether it takes null.

Group: Table. Power Query M has it too: a query that uses it is written as in Power BI.

Syntax

Table.Schema(table as table) as table
ParameterTypeDescription
tabletableThe table to describe.

Returns

table. A row per column, with Power Query's 19 columns describing it: first Name, Position (from 0), TypeName, Kind and IsNullable.

Remarks

  • TypeName is the type's name as M writes it (Text.Type, Int64.Type); Kind is the kind of value behind it (text, number).
  • A column without a type has Kind any, and IsNullable is true.
  • The other 14 columns (NumericPrecision, MaxLength, NativeTypeName, Description and the rest) describe a database column; they are null for a table made in M.

Examples

The columns of a typed table

The example keeps the five columns this page describes.

let
    Products = #table(type table [Product = text, Price = nullable number, Units = Int64.Type, Note = any], {})
in
    Table.SelectColumns(Table.Schema(Products), {"Name", "Position", "TypeName", "Kind", "IsNullable"})
NamePositionTypeNameKindIsNullable
Product0Text.Typetextfalse
Price1Number.Typenumbertrue
Units2Int64.Typenumberfalse
Note3Any.Typeanytrue

Table.ColumnNames, Table.ColumnsOfType, Table.TransformColumnTypes, Value.Type.

Last updated · OpenBI Studio 0.3.79