sqlload 0.69.0

SQL data loading tooling.
//! What a destination takes.

use crate::adapters::databricks::main::stage::_writer_accepts::writer_accepts as databricks_accepts;
use crate::adapters::dispatch::models::Destination;
use crate::adapters::snowflake::main::stage::_writer_accepts::writer_accepts as snowflake_accepts;
use crate::adapters::snowflake::models::StageRoute;
use crate::routing::models::WriterAccepts;
use crate::routing::models::{FileFormat, Store};

/// What `destination` takes over the chosen `stage`: Arrow batches (DuckDB also reads Parquet in S3 or on this machine itself, but MotherDuck does not; ClickHouse reads Parquet in S3), or what its stage route takes.
pub fn writer_accepts(destination: &Destination, stage: Option<&StageRoute>) -> WriterAccepts {
    match destination {
        #[cfg(feature = "duckdb")]
        Destination::DuckDb(duckdb) if duckdb.motherduck => WriterAccepts {
            arrow: true,
            ..WriterAccepts::default()
        },
        #[cfg(feature = "duckdb")]
        Destination::DuckDb(_) => WriterAccepts {
            arrow: true,
            pulls_from: vec![
                Store::ObjectStore("s3://".to_owned()),
                Store::Local(String::new()),
            ],
            pull_formats: vec![FileFormat::Parquet],
            ..WriterAccepts::default()
        },
        Destination::ClickHouse(_) => WriterAccepts {
            arrow: true,
            pulls_from: vec![Store::ObjectStore("s3://".to_owned())],
            pull_formats: vec![FileFormat::Parquet],
            ..WriterAccepts::default()
        },
        Destination::Files(_) | Destination::BigQuery(_) | Destination::Postgres(_) => {
            WriterAccepts {
                arrow: true,
                ..WriterAccepts::default()
            }
        }
        Destination::Snowflake(_) => snowflake_accepts(stage),
        Destination::Databricks(databricks) => databricks_accepts(databricks),
    }
}