@@ -1459,25 +1459,27 @@ def _is_udtf(expr: exp.Expression) -> bool:
14591459 )
14601460
14611461
1462+ def _single_value_or_tuple (values : t .Sequence ) -> exp .Identifier | exp .Tuple :
1463+ return (
1464+ exp .to_identifier (values [0 ])
1465+ if len (values ) == 1
1466+ else exp .Tuple (expressions = [exp .to_identifier (v ) for v in values ])
1467+ )
1468+
1469+
14621470META_FIELD_CONVERTER : t .Dict [str , t .Callable ] = {
14631471 "name" : lambda value : exp .to_table (value ),
14641472 "start" : lambda value : exp .Literal .string (value ),
14651473 "cron" : lambda value : exp .Literal .string (value ),
14661474 "batch_size" : lambda value : exp .Literal .number (value ),
1467- "partitioned_by_" : lambda value : (
1468- exp .to_identifier (value [0 ]) if len (value ) == 1 else exp .Tuple (expressions = value )
1469- ),
1475+ "partitioned_by_" : _single_value_or_tuple ,
14701476 "depends_on_" : lambda value : exp .Tuple (expressions = value ),
14711477 "pre" : _list_of_calls_to_exp ,
14721478 "post" : _list_of_calls_to_exp ,
14731479 "audits" : _list_of_calls_to_exp ,
14741480 "columns_to_types_" : lambda value : exp .Schema (
14751481 expressions = [exp .ColumnDef (this = exp .to_column (c ), kind = t ) for c , t in value .items ()]
14761482 ),
1477- "tags" : lambda value : (
1478- exp .to_identifier (value [0 ]) if len (value ) == 1 else exp .Tuple (expressions = value )
1479- ),
1480- "grain" : lambda value : (
1481- exp .to_column (value [0 ]) if len (value ) == 1 else exp .Tuple (expressions = exp .to_column (value ))
1482- ),
1483+ "tags" : _single_value_or_tuple ,
1484+ "grain" : _single_value_or_tuple ,
14831485}
0 commit comments