@@ -559,6 +559,47 @@ pub struct DataMetricFunctionAction {
559559 pub items : Vec < DataMetricFunctionItem > ,
560560}
561561
562+ /// Snowflake `{ CREATE | DEFINE } [ SECURE ] DATA METRIC FUNCTION`.
563+ #[ derive( sqlquack_syntax_derive:: AstNode , Debug , Clone , PartialEq , Serialize , Deserialize ) ]
564+ pub struct CreateDataMetricFunction {
565+ /// The leading keyword: "CREATE" or "DEFINE".
566+ pub verb : String ,
567+ #[ serde( default , skip_serializing_if = "std::ops::Not::not" ) ]
568+ pub or_replace : bool ,
569+ #[ serde( default , skip_serializing_if = "std::ops::Not::not" ) ]
570+ pub or_alter : bool ,
571+ #[ serde( default , skip_serializing_if = "std::ops::Not::not" ) ]
572+ pub secure : bool ,
573+ #[ serde( default , skip_serializing_if = "std::ops::Not::not" ) ]
574+ pub if_not_exists : bool ,
575+ pub name : TableRef ,
576+ pub arguments : Vec < DataMetricTableArgument > ,
577+ pub return_type : DataType ,
578+ /// `NULL` as true or `NOT NULL` as false after the return type, absent without either.
579+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
580+ pub nullable : Option < bool > ,
581+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
582+ pub language : Option < Identifier > ,
583+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
584+ pub comment : Option < Expression > ,
585+ /// The `AS` body, a string literal.
586+ pub body : Expression ,
587+ }
588+
589+ /// One `<name> TABLE ( <column> <type>, ... )` argument of a data metric function.
590+ #[ derive( sqlquack_syntax_derive:: AstNode , Debug , Clone , PartialEq , Serialize , Deserialize ) ]
591+ pub struct DataMetricTableArgument {
592+ pub name : Identifier ,
593+ pub columns : Vec < DataMetricColumn > ,
594+ }
595+
596+ /// One `<column> <type>` of a data metric function's table argument.
597+ #[ derive( sqlquack_syntax_derive:: AstNode , Debug , Clone , PartialEq , Serialize , Deserialize ) ]
598+ pub struct DataMetricColumn {
599+ pub name : Identifier ,
600+ pub data_type : DataType ,
601+ }
602+
562603/// One `<name> ON ( <argument>, ... )` of a data metric function action, with its clauses.
563604#[ derive( sqlquack_syntax_derive:: AstNode , Debug , Clone , PartialEq , Serialize , Deserialize ) ]
564605pub struct DataMetricFunctionItem {
0 commit comments