Module copy

Module copy 

Source
Expand description

COPY TO and COPY FROM implementation โ€” exports/imports CSV data.

Supports: COPY [ks.]table [(col1, col2, ...)] TO 'filename'|STDOUT [WITH options...] COPY [ks.]table [(col1, col2, ...)] FROM 'filename'|STDIN [WITH options...]

Structsยง

CopyFromCommand
A parsed COPY FROM command.
CopyFromOptions
Options specific to COPY FROM (CSV import).
CopyOptions
All options controlling CSV export behavior.
CopyToCommand
A parsed COPY TO command.
TokenBucket ๐Ÿ”’
Simple token bucket for rate limiting row inserts.

Enumsยง

CopyTarget
Where to write/read the CSV data.

Functionsยง

build_csv_writer ๐Ÿ”’
Build a csv::Writer with the configured options.
cql_value_to_insert_literal ๐Ÿ”’
Convert a CqlValue to a CQL insert literal string.
csv_str_to_cql_value
Convert a CSV string field to a typed CqlValue based on the CQL column type.
execute_copy_from
Execute a COPY FROM command, importing CSV data into a table.
execute_copy_to
Execute a COPY TO command, writing results as CSV.
find_keyword_outside_parens ๐Ÿ”’
Find a keyword in the string that is not inside parentheses. Returns the byte offset of the keyword start.
format_float ๐Ÿ”’
Format a floating-point number with given precision and decimal separator.
format_timestamp ๐Ÿ”’
Format a timestamp (millis since epoch) using the configured format.
format_value_for_csv
Format a single CQL value for CSV output according to the given options.
insert_row_with_retry ๐Ÿ”’
Execute a single row INSERT with retry on failure.
parse_bool_option ๐Ÿ”’
Parse a boolean option value (true/false, yes/no, 1/0).
parse_copy_from
Parse a COPY ... FROM ... statement.
parse_copy_from_options ๐Ÿ”’
Parse opt1=val1 AND opt2=val2 ... pairs into CopyFromOptions.
parse_copy_to
Parse a COPY ... TO ... statement.
parse_options ๐Ÿ”’
Parse opt1=val1 AND opt2=val2 ... pairs into CopyOptions.
parse_source_and_options ๐Ÿ”’
Parse the source and WITH options after the FROM keyword. Returns (CopyTarget, Option<options_string>).
parse_table_spec ๐Ÿ”’
Parse the table spec: [ks.]table [(col1, col2, ...)]
parse_target_and_options ๐Ÿ”’
Parse the target and WITH options after the TO keyword. Returns (CopyTarget, Option<options_string>).
split_on_and ๐Ÿ”’
Split a string on AND keywords (case-insensitive), not inside quotes.
strip_frozen ๐Ÿ”’
Strip the frozen<...> wrapper from a CQL type name, if present.
unquote ๐Ÿ”’
Remove surrounding single or double quotes from a value.