tlc.core.objects.tables.from_url.table_from_csv#

A table populated from a comma-separated values (CSV) string loaded from a URL

Module Contents#

Classes#

Class

Description

TableFromCsv

A table populated from a comma-separated values (CSV) string loaded from a URL.

API#

class tlc.core.objects.tables.from_url.table_from_csv.TableFromCsv(url: tlc.core.url.Url | None = None, created: str | None = None, row_cache_url: tlc.core.url.Url | None = None, row_cache_populated: bool | None = None, override_table_rows_schema: Any = None, init_parameters: Any = None, input_url: tlc.core.url.Url | None = None)#

Bases: tlc.core.objects.table.Table

A table populated from a comma-separated values (CSV) string loaded from a URL.

This class represents a table that is loaded from a CSV file at the given URL. Its Schema is approximated as strings for all columns unless the property override_table_rows_schema is used, in which case:

  • the effective schema is modified with the given overrides, that may be “sparse”

  • the row-values are converted from str to a matching type which may not be exactly the override type, but should be compatible. Ie. if the override type is Int32Value and the value is 123 then the value will be converted to python type int

Parameters:
  • url – URL of the table.

  • created – Creation timestamp.

  • dataset_name – Name of the dataset.

  • project_name – Name of the project.

  • row_cache_url – URL for row cache.

  • row_cache_populated – Flag to indicate if the row cache is populated.

  • override_table_rows_schema – Schema to override the default (naive) table rows schema.

  • init_parameters – Initialization parameters for serialization.

  • input_url – The input URL for the CSV data. This is required.

Raises:

ValueError – if the input URL is not provided.

find_column_atomic_type(column_name: str) str#

Finds which type each column should be represented as.

This is taken from the ‘Table.override_table_rows_schema’ property.