File: 127_more_comments.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 (56 lines) | stat: -rw-r--r-- 1,472 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
-- source: https://github.com/tconbeer/sqlfmt/issues/348
-- source: https://github.com/tconbeer/sqlfmt/issues/628
-- depends_on: {{ ref('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') }}
with table_a as (
    select
        /* Notice that this select statement can fit on a single line without comments */
        col1,
        col2, -- col2
        /* Special column */
        special_column,
    from {{ ref("table_a" )}}
)

/* Some interesting comments above a CTE with a leading comma */
, table_b as (
    select *
    from {{ ref("table_b") }}
)

select *
from table_a, table_b;

select 1
-- two
, 2 -- two inline
-- three
, 3 -- three inline
, 4 -- four inline
)))))__SQLFMT_OUTPUT__(((((
-- source: https://github.com/tconbeer/sqlfmt/issues/348
-- source: https://github.com/tconbeer/sqlfmt/issues/628
-- depends_on: {{ ref('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') }}
with
    table_a as (
        select
            /* Notice that this select statement can fit on a single line without comments */
            col1,
            col2,  -- col2
            /* Special column */
            special_column,
        from {{ ref("table_a") }}
    ),
    /* Some interesting comments above a CTE with a leading comma */
    table_b as (select * from {{ ref("table_b") }})

select *
from table_a, table_b
;

select
    1,
    -- two
    2,  -- two inline
    -- three
    3,  -- three inline
    4  -- four inline