sqlload 0.70.2

SQL data loading tooling.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Run a query returning one text column.

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

/// The first column of every row of `query`, as text; SQL `NULL`s are skipped.
pub async fn query_texts(
    destination: &SnowflakeDestination,
    query: &str,
) -> Result<Vec<String>, ApiError> {
    let rows = execute_sql(&destination.sql, query).await?;
    Ok(rows
        .rows
        .into_iter()
        .filter_map(|row| row.into_iter().next().flatten())
        .collect())
}