File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -613,6 +613,12 @@ impl DialectHandler for SnowflakeDialect {
613613 false
614614 }
615615
616+ fn interval_quoting_style ( & self , _dtf : & DateTimeField ) -> IntervalQuotingStyle {
617+ // Snowflake requires quotes around value and unit together
618+ // https://docs.snowflake.com/en/sql-reference/data-types-datetime#interval-constants
619+ IntervalQuotingStyle :: ValueAndUnitQuoted
620+ }
621+
616622 fn requires_order_by_in_window_function ( & self ) -> bool {
617623 // https://docs.snowflake.com/en/sql-reference/functions/row_number
618624 // ROW_NUMBER() requires ORDER BY in window specification
Original file line number Diff line number Diff line change @@ -1591,6 +1591,20 @@ fn test_interval() {
15911591 FROM
15921592 projects
15931593 "# ) ;
1594+
1595+ let query = r###"
1596+ prql target:sql.snowflake
1597+
1598+ from projects
1599+ derive first_check_in = start + 10days
1600+ "### ;
1601+ assert_snapshot ! ( ( compile( query) . unwrap( ) ) , @r#"
1602+ SELECT
1603+ *,
1604+ "start" + INTERVAL '10 DAY' AS "first_check_in"
1605+ FROM
1606+ "projects"
1607+ "# ) ;
15941608}
15951609
15961610#[ test]
You can’t perform that action at this time.
0 commit comments