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ยง
- Copy
From Command - A parsed COPY FROM command.
- Copy
From Options - Options specific to COPY FROM (CSV import).
- Copy
Options - All options controlling CSV export behavior.
- Copy
ToCommand - A parsed COPY TO command.
- Token
Bucket ๐ - Simple token bucket for rate limiting row inserts.
Enumsยง
- Copy
Target - 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
CqlValueto a CQL insert literal string. - csv_
str_ to_ cql_ value - Convert a CSV string field to a typed
CqlValuebased 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 intoCopyFromOptions. - parse_
copy_ to - Parse a
COPY ... TO ...statement. - parse_
options ๐ - Parse
opt1=val1 AND opt2=val2 ...pairs intoCopyOptions. - 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
ANDkeywords (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.