iffyio commented on code in PR #2264:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/2264#discussion_r2904181317


##########
tests/sqlparser_snowflake.rs:
##########
@@ -286,6 +286,46 @@ fn test_snowflake_create_table_with_row_access_policy() {
     }
 }
 
+#[test]
+fn test_snowflake_create_table_with_storage_lifecycle_policy() {
+    // WITH keyword
+    match snowflake().verified_stmt(
+        "CREATE TABLE IF NOT EXISTS my_table (a NUMBER(38, 0), b VARIANT) WITH 
STORAGE LIFECYCLE POLICY dba.global_settings.my_policy ON (a)",
+    ) {
+        Statement::CreateTable(CreateTable {
+            name,
+            with_storage_lifecycle_policy,
+            ..
+        }) => {
+            assert_eq!("my_table", name.to_string());
+            let policy = with_storage_lifecycle_policy.unwrap();
+            assert_eq!("dba.global_settings.my_policy", 
policy.policy.to_string());
+            assert_eq!(vec![Ident::new("a")], policy.on);
+        }
+        _ => unreachable!(),
+    }
+
+    // Without WITH keyword
+    match snowflake()
+        .parse_sql_statements(
+            "CREATE TABLE my_table (a NUMBER(38,0)) STORAGE LIFECYCLE POLICY 
my_policy ON (a, b)",
+        )

Review Comment:
   can we use `one_statement_parses_to` to assert what this statement is 
displayed as?



##########
src/ast/ddl.rs:
##########
@@ -2999,6 +2999,9 @@ pub struct CreateTable {
     /// Snowflake "WITH ROW ACCESS POLICY" clause
     /// <https://docs.snowflake.com/en/sql-reference/sql/create-table>
     pub with_row_access_policy: Option<RowAccessPolicy>,
+    /// Snowflake "WITH STORAGE LIFECYCLE POLICY" clause

Review Comment:
   ```suggestion
       /// Snowflake `WITH STORAGE LIFECYCLE POLICY` clause
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to