Add support for Snowflake LIST and REMOVE (#1639)

This commit is contained in:
Yoav Cohen 2025-01-06 16:41:09 +01:00 committed by GitHub
parent 17e22f0a60
commit 4c6af0ae4f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 97 additions and 5 deletions

View file

@ -2991,3 +2991,34 @@ fn test_table_sample() {
snowflake_and_generic().verified_stmt("SELECT id FROM mytable TABLESAMPLE (10) REPEATABLE (1)");
snowflake_and_generic().verified_stmt("SELECT id FROM mytable TABLESAMPLE (10) SEED (1)");
}
#[test]
fn parse_ls_and_rm() {
snowflake().one_statement_parses_to("LS @~", "LIST @~");
snowflake().one_statement_parses_to("RM @~", "REMOVE @~");
let statement = snowflake()
.verified_stmt("LIST @SNOWFLAKE_KAFKA_CONNECTOR_externalDataLakeSnowflakeConnector_STAGE_call_tracker_stream/");
match statement {
Statement::List(command) => {
assert_eq!(command.stage, ObjectName(vec!["@SNOWFLAKE_KAFKA_CONNECTOR_externalDataLakeSnowflakeConnector_STAGE_call_tracker_stream/".into()]));
assert!(command.pattern.is_none());
}
_ => unreachable!(),
};
let statement =
snowflake().verified_stmt("REMOVE @my_csv_stage/analysis/ PATTERN='.*data_0.*'");
match statement {
Statement::Remove(command) => {
assert_eq!(
command.stage,
ObjectName(vec!["@my_csv_stage/analysis/".into()])
);
assert_eq!(command.pattern, Some(".*data_0.*".to_string()));
}
_ => unreachable!(),
};
snowflake().verified_stmt(r#"LIST @"STAGE_WITH_QUOTES""#);
}