kumoai.connector.S3Connector#

class kumoai.connector.S3Connector[source]#

Bases: FileConnector

Defines a connector to a table stored as a file (or partitioned set of files) on the Amazon S3 object store. Any table behind an S3 bucket accessible by the shared external IAM role can be accessed through this connector.

import kumoai
connector = kumoai.S3Connector(root_dir="s3://...")  # an S3 path.

# List all tables:
print(connector.table_names())  # Returns: ['articles', 'customers', 'users']

# Check whether a table is present:
assert "articles" in connector

# Fetch a source table (both approaches are equivalent):
source_table = connector["articles"]
source_table = connector.table("articles")
Parameters:

root_dir (Optional[str]) – The root directory of this connector. If provided, the root directory is used as a prefix for tables in this connector. If not provided, all tables must be specified by their full S3 paths.

property source_type: DataSourceType#

Returns the data source type accessible by this connector.

__init__(root_dir=None, _connector_id=None)#
classmethod get_by_name(name)#

Returns an instance of a named file connector, created in the Kumo UI.

Parameters:

name (str) – The name of the existing connector.

Return type:

Self

has_table(name)#

Returns True if the table exists in this connector, False otherwise.

Parameters:

name (str) – The table name.

Return type:

bool

property name: str#

Returns the name of the connector.

Note

If the connector does not support naming, the name refers to an internal specifier.

table(name)#

Returns a SourceTable object corresponding to a source table behind this connector. A source table is a view into the raw data of table name. To use a source table in Kumo, you will need to construct a Table from the source table.

Parameters:

name (str) – The table name.

Raises:

ValueError – if name does not exist in the backing connector.

Return type:

SourceTable

table_names()#

Returns a list of table names accessible through this connector.

Return type:

List[str]