CSVTable๏ƒ

Inherits: RefCounted < Object

Table-style query helper for CSV rows.

Description๏ƒ

CSVTable stores CSV data as an array of dictionaries and provides filtering, projection, renaming, grouping, indexing, and join helpers.

Methods๏ƒ

CSVTable

apply_model(model: CSVRowModel) const

CSVIndex

build_index(column: StringName, unique: bool = false) const

PackedStringArray

column_names() const

CSVTable

distinct(columns: PackedStringArray = PackedStringArray()) const

CSVTable

drop_columns(columns: PackedStringArray) const

CSVTable

filter_rows(predicate: Callable) const

CSVTable

from_csv(csv: CSV) static

CSVTable

from_file(path: String, delimiter: String = ",", options: Dictionary = {}) static

CSVTable

from_file_with_dialect(path: String, dialect: CSVDialect) static

CSVTable

from_rows(rows: Array) static

Array

get_rows() const

Dictionary

group_by(column: StringName) const

CSVTable

inner_join(other: CSVTable, left_column: StringName, right_column: StringName) const

CSVTable

left_join(other: CSVTable, left_column: StringName, right_column: StringName) const

CSVTable

limit(count: int, offset: int = 0) const

CSVTable

map_rows(transform: Callable) const

CSVTable

rename_columns(map: Dictionary) const

int

row_count() const

CSVTable

select_columns(columns: PackedStringArray) const

void

set_rows(rows: Array)

CSVTable

sort_by(column: StringName, ascending: bool = true) const

CSVTable

sort_by_columns(columns: PackedStringArray, ascending: bool = true) const

Array

validate_model(model: CSVRowModel) const

CSVTable

where_equals(column: StringName, value: Variant) const

CSVTable

where_in(column: StringName, values: Array) const

CSVTable

with_column(column: StringName, value_or_callable: Variant) const


Method Descriptions๏ƒ

CSVTable apply_model(model: CSVRowModel) const ๐Ÿ”—

Returns a table with each row cast by model.


CSVIndex build_index(column: StringName, unique: bool = false) const ๐Ÿ”—

Builds an index for column. If unique is true, duplicate keys are recorded by the returned CSVIndex.


PackedStringArray column_names() const ๐Ÿ”—

Returns all column names found across rows, preserving first-seen order.


CSVTable distinct(columns: PackedStringArray = PackedStringArray()) const ๐Ÿ”—

Returns a table containing the first row for each unique key. When columns is empty, the entire row is used as the key.


CSVTable drop_columns(columns: PackedStringArray) const ๐Ÿ”—

Returns a table with columns removed from every row.


CSVTable filter_rows(predicate: Callable) const ๐Ÿ”—

Returns rows for which predicate returns a truthy value. The callable receives the row and row index.


CSVTable from_csv(csv: CSV) static ๐Ÿ”—

Creates a table from a CSV resource's rows.


CSVTable from_file(path: String, delimiter: String = ",", options: Dictionary = {}) static ๐Ÿ”—

Loads a header-based CSV file into a table using CSVImporter.import_with_headers().


CSVTable from_file_with_dialect(path: String, dialect: CSVDialect) static ๐Ÿ”—

Creates a table by importing path using dialect.


CSVTable from_rows(rows: Array) static ๐Ÿ”—

Creates a table from dictionary rows. Array rows are converted to dictionaries using numeric keys.


Array get_rows() const ๐Ÿ”—

Returns a copy of the table rows.


Dictionary group_by(column: StringName) const ๐Ÿ”—

Groups rows by column, returning a dictionary of key to row arrays.


CSVTable inner_join(other: CSVTable, left_column: StringName, right_column: StringName) const ๐Ÿ”—

Returns rows formed by joining this table to other where the join columns match.


CSVTable left_join(other: CSVTable, left_column: StringName, right_column: StringName) const ๐Ÿ”—

Returns all rows from this table, joined to matching rows from other when present.


CSVTable limit(count: int, offset: int = 0) const ๐Ÿ”—

Returns up to count rows, skipping the first offset rows.


CSVTable map_rows(transform: Callable) const ๐Ÿ”—

Returns a table containing dictionaries returned by transform. The callable receives the row and row index.


CSVTable rename_columns(map: Dictionary) const ๐Ÿ”—

Returns a table with columns renamed according to map.


int row_count() const ๐Ÿ”—

Returns the number of rows.


CSVTable select_columns(columns: PackedStringArray) const ๐Ÿ”—

Returns a table containing only columns.


void set_rows(rows: Array) ๐Ÿ”—

Replaces table rows.


CSVTable sort_by(column: StringName, ascending: bool = true) const ๐Ÿ”—

Returns a table stably sorted by column.


CSVTable sort_by_columns(columns: PackedStringArray, ascending: bool = true) const ๐Ÿ”—

Returns a table stably sorted by columns in lexicographic order.


Array validate_model(model: CSVRowModel) const ๐Ÿ”—

Validates each row with model, returning row-indexed validation reports.


CSVTable where_equals(column: StringName, value: Variant) const ๐Ÿ”—

Returns rows where column equals value.


CSVTable where_in(column: StringName, values: Array) const ๐Ÿ”—

Returns rows where column matches any value in values.


CSVTable with_column(column: StringName, value_or_callable: Variant) const ๐Ÿ”—

Returns a table with column set to a constant value, or to the result of a callable that receives the row and row index.