File: 101_multiline.sql

package info (click to toggle)
sqlfmt 0.29.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,580 kB
  • sloc: python: 10,007; sql: 5,626; makefile: 39
file content (71 lines) | stat: -rw-r--r-- 1,699 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{{
    config(
        materialized='table',
        sort='id',
        dist='all',
        post_hook='grant select on {{ this }} to role bi_role'
    )
}}

/*
 * This is a typical multiline comment.
 * It contains newlines.
 * And even /* some {% special characters %}
 * but we're not going to parse those
*/

with
    source as (select * from {{ ref('my_model') }}),
    renamed as ( /* This is a multiline comment in very bad style,
    * which starts and ends on lines with other tokens.
    */  select
            id,
            another_field,
            and_another,
            and_still_another
        from source
    ), {% set my_variable_in_bad_style = [
        "a",
        "short",
        "list",
        "of",
        "strings"
    ] %}

{#
 # And this is a nice multiline jinja comment
 # that we will also handle.
#}

select * from renamed /* what!?! */ where true
)))))__SQLFMT_OUTPUT__(((((
{{
    config(
        materialized="table",
        sort="id",
        dist="all",
        post_hook="grant select on {{ this }} to role bi_role",
    )
}}

/*
 * This is a typical multiline comment.
 * It contains newlines.
 * And even /* some {% special characters %}
 * but we're not going to parse those
*/
with
    source as (select * from {{ ref("my_model") }}),
    /* This is a multiline comment in very bad style,
    * which starts and ends on lines with other tokens.
    */
    renamed as (select id, another_field, and_another, and_still_another from source),
    {% set my_variable_in_bad_style = ["a", "short", "list", "of", "strings"] %}

{#
 # And this is a nice multiline jinja comment
 # that we will also handle.
#}
select *
from renamed  /* what!?! */
where true