sqlload 0.10.0

SQL data loading tooling. Pre-release, under development.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! A files batch loaded by the destination itself.

use crate::adapters::dispatch::models::Writer;
use crate::adapters::snowflake::models::{DirectBatch, DirectLoaded};
use crate::loader::errors::LoaderError;

/// Load `batch` by having the destination read the source's files itself (Snowflake's `COPY` from an external stage); `None` when SQLLoad must read the batch.
pub async fn load_files(
    writer: &mut Writer,
    batch: &DirectBatch<'_>,
) -> Result<Option<DirectLoaded>, LoaderError> {
    match writer {
        Writer::Snowflake(snowflake) => snowflake.copy_files(batch).await,
        _ => Ok(None),
    }
}