mirror of https://github.com/buster-so/buster.git
Merge pull request #95 from buster-so/staging
fix: janky check for values
This commit is contained in:
commit
6535947d23
|
@ -49,9 +49,12 @@ pub async fn snowflake_query(
|
||||||
) -> Result<Vec<IndexMap<std::string::String, DataType>>, Error> {
|
) -> Result<Vec<IndexMap<std::string::String, DataType>>, Error> {
|
||||||
const MAX_ROWS: usize = 5_000;
|
const MAX_ROWS: usize = 5_000;
|
||||||
|
|
||||||
// Wrap the original query in a limit clause
|
let query_no_semicolon = query.trim_end_matches(';');
|
||||||
// let limited_query = format!("SELECT * FROM ({}) tmp_query LIMIT {}", query.replace(";", ""), MAX_ROWS);
|
let limited_query = if !query_no_semicolon.to_lowercase().contains("limit") {
|
||||||
let limited_query = query;
|
format!("{} FETCH FIRST {} ROWS ONLY", query_no_semicolon, MAX_ROWS)
|
||||||
|
} else {
|
||||||
|
query_no_semicolon.to_string()
|
||||||
|
};
|
||||||
|
|
||||||
let rows = match snowflake_client.exec(&limited_query).await {
|
let rows = match snowflake_client.exec(&limited_query).await {
|
||||||
Ok(result) => match result {
|
Ok(result) => match result {
|
||||||
|
|
Loading…
Reference in New Issue