Skip to main content
Once you’ve connected your source tables and applied any necessary transformations, you can construct a Graph consisting of Table objects. A Kumo Graph represents a connected set of Tables, with each table fully specifying the relevant metadata (including selected source columns, column data type and semantic type, and relational constraint information) of SourceTables for modeling purposes.

Creating Tables from Source

A Table can be constructed from a SourceTable in multiple ways. The simplest approach is to call from_source_table():
# NOTE if `columns` is not specified, all source columns are included:
customer = kumo.Table.from_source_table(
    source_table=customer_src,
    primary_key='CustomerID',
).infer_metadata()

transaction = kumo.Table.from_source_table(
    source_table=transaction_src,
    time_column='InvoiceDate',
).infer_metadata()

Inspecting Table Metadata

To verify the metadata that was inferred, call the metadata property:
>>> print(customer.metadata)

+----+-----------+---------+---------+------------------+------------------+----------------------+
|    | name      | dtype   | stype   | is_primary_key   | is_time_column   | is_end_time_column   |
|----+-----------+---------+---------+------------------+------------------+----------------------|
|  0 | StockCode | string  | ID      | True             | False            | False                |
+----+-----------+---------+---------+------------------+------------------+----------------------+
If any column properties are not specified to your liking, you can edit them by accessing their names in the table.

Building Tables from Scratch

You can also specify the table from the ground-up, optionally inferring metadata for any non-fully-specified columns:
stock = kumo.Table(
    source_table=stock_src,
    columns=dict(name='StockCode', stype='ID'),  # will infer dtype='string'
    primary_key='StockCode',
).infer_metadata()

# Validate the table's correctness:
stock.validate(verbose=True)

Modifying Table Metadata

No matter how you create your table, Table exposes methods to inspect and adjust metadata:
# Set and access a data type for a column ("StockCode") in the stock table:
stock.column("StockCode").dtype = "string"
print(stock["StockCode"].dtype)
Note that column() returns a Column object, which contains the relevant metadata for the column of a table.