Skip to main content

ImportQuery

Struct ImportQuery 

Source
pub struct ImportQuery { /* private fields */ }
Expand description

Builder for constructing Exasol IMPORT SQL statements.

The ImportQuery builder allows you to configure all aspects of an IMPORT statement including the target table, columns, CSV format options, and error handling.

§Multi-file Import

For parallel imports, use with_files() instead of at_address() and file_name():

use exarrow_rs::query::import::{ImportQuery, ImportFileEntry};

let entries = vec![
    ImportFileEntry::new("10.0.0.5:8563".to_string(), "001.csv".to_string(), None),
    ImportFileEntry::new("10.0.0.6:8563".to_string(), "002.csv".to_string(), None),
];

let query = ImportQuery::new("my_table")
    .with_files(entries)
    .build();

Implementations§

Source§

impl ImportQuery

Source

pub fn new(table: &str) -> Self

Create a new ImportQuery builder for the specified table.

§Arguments
  • table - The name of the target table to import into
Source

pub fn schema(self, schema: &str) -> Self

Set the target schema for the import.

§Arguments
  • schema - The schema name
Source

pub fn columns(self, cols: Vec<&str>) -> Self

Set the columns to import into.

If not specified, all columns in the table will be used.

§Arguments
  • cols - List of column names
Source

pub fn at_address(self, addr: &str) -> Self

Set the HTTP address to import from.

§Arguments
  • addr - HTTP address in “host:port” format
Source

pub fn with_public_key(self, fingerprint: &str) -> Self

Set the public key fingerprint for TLS verification.

When set, HTTPS will be used and the PUBLIC KEY clause will be added.

§Arguments
  • fingerprint - SHA-256 fingerprint of the server’s public key
Source

pub fn file_name(self, name: &str) -> Self

Set the file name for the import.

§Arguments
  • name - File name (default “001.csv”)
Source

pub fn column_separator(self, sep: char) -> Self

Set the column separator character.

§Arguments
  • sep - Separator character (default ‘,’)
Source

pub fn column_delimiter(self, delim: char) -> Self

Set the column delimiter character for quoting.

§Arguments
  • delim - Delimiter character (default ‘“’)
Source

pub fn row_separator(self, sep: RowSeparator) -> Self

Set the row separator.

§Arguments
  • sep - Row separator (default LF)
Source

pub fn encoding(self, enc: &str) -> Self

Set the character encoding.

§Arguments
  • enc - Encoding name (default “UTF-8”)
Source

pub fn skip(self, rows: u32) -> Self

Set the number of header rows to skip.

§Arguments
  • rows - Number of rows to skip (default 0)
Source

pub fn null_value(self, val: &str) -> Self

Set a custom NULL value representation.

§Arguments
  • val - String representing NULL values in the CSV
Source

pub fn trim(self, trim: TrimMode) -> Self

Set the trim mode for imported values.

§Arguments
  • trim - Trim mode to apply
Source

pub fn compressed(self, compression: Compression) -> Self

Set the compression type for the import file.

This affects the file extension in the generated SQL.

§Arguments
  • compression - Compression type
Source

pub fn reject_limit(self, limit: u32) -> Self

Set the reject limit for error handling.

§Arguments
  • limit - Maximum number of invalid rows before the import fails
Source

pub fn with_files(self, entries: Vec<ImportFileEntry>) -> Self

Set multiple file entries for parallel import.

This method enables multi-file IMPORT statements where each file has its own AT/FILE clause with a unique internal address.

§Arguments
  • entries - Vector of file entries with addresses and file names
§Note

When using with_files(), the at_address() and file_name() methods are ignored and should not be called.

Source

pub fn build(&self) -> String

Build the complete IMPORT SQL statement.

§Returns

The generated IMPORT SQL statement as a string.

Trait Implementations§

Source§

impl Clone for ImportQuery

Source§

fn clone(&self) -> ImportQuery

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ImportQuery

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,