You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
version: 2macros:
- name: cents_to_dollarsdescription: A macro to convert cents to dollarsarguments:
- name: column_nametype: stringdescription: The name of the column you want to convert
- name: precisiontype: integerdescription: Number of decimal places. Defaults to 2.
Note the type field, which is currently unvalidated and used only for the purpose of documentation. We will provide opt-in validation and functionality for this field.
The type field will now support any value given by the following rule.
<T> :=
str
string
bool
int
integer
float
Any
List[<T>]
Dict[<T>, <T>]
Optional[<T>]
Relation
Column
So, str, bool, List[str], and Dict[str, List[int]], would all be valid types. Although this naming convention follows Python style conventions, these types should not be confused with Python types. Note that string is a synonym for str and integer is a synonym for int. This flexibility will allow users to avoid revising existing documentation which may have used older, inconsistent conventions.
The type field is not currently validated, and we will continue to permit any value, unless --type-check flag is used. In that case, type names not explicitly allowed by the rule above will generate an error, and dbt will perform basic static type checking when the marco is called in order to detect coding errors.
SQL Syntax Hints
We will add another type to indicate a string is a specific SQL syntax. For example,
- name: column_name
type: string[ColumnName]
description: The name of the column you want to convert
Other supported values supported in v1 will be string[Expr] (general expression) string[Cond] (general condition) or string[SqlExpr] (indicating that the expression should be valid SQL but is otherwise unrestricted).
Changes to the Manifest
The type field should be included in the manifest so that downstream systems can use type information to support new features.
The text was updated successfully, but these errors were encountered:
Type Checking
We support documenting macros in yml files. Here is the standard example:
Note the
type
field, which is currently unvalidated and used only for the purpose of documentation. We will provide opt-in validation and functionality for this field.The
type
field will now support any value given by the following rule.So,
str
,bool
,List[str]
, andDict[str, List[int]]
, would all be valid types. Although this naming convention follows Python style conventions, these types should not be confused with Python types. Note thatstring
is a synonym forstr
andinteger
is a synonym forint
. This flexibility will allow users to avoid revising existing documentation which may have used older, inconsistent conventions.The
type
field is not currently validated, and we will continue to permit any value, unless--type-check
flag is used. In that case, type names not explicitly allowed by the rule above will generate an error, and dbt will perform basic static type checking when the marco is called in order to detect coding errors.SQL Syntax Hints
We will add another
type
to indicate a string is a specific SQL syntax. For example,Other supported values supported in v1 will be
string[Expr]
(general expression)string[Cond]
(general condition) orstring[SqlExpr]
(indicating that the expression should be valid SQL but is otherwise unrestricted).Changes to the Manifest
The
type
field should be included in the manifest so that downstream systems can use type information to support new features.The text was updated successfully, but these errors were encountered: