sqlload 0.11.1

SQL data loading tooling. Pre-release, under development.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! Run a `COPY` statement and count what it loaded.

use crate::adapters::snowflake::_helpers::write::rows_loaded::rows_loaded;
use crate::adapters::snowflake::models::SnowflakeDestination;
use crate::http::errors::ApiError;
use crate::sql_api::main::execute_sql::execute_sql;

/// Run `statement` (a `COPY INTO`) and return the rows it loaded.
pub(in crate::adapters) async fn copy_rows(
    destination: &SnowflakeDestination,
    statement: &str,
) -> Result<u64, ApiError> {
    rows_loaded(&execute_sql(&destination.sql, statement).await?)
}