forked from sqlfluff/sqlfluff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AL06.yml
71 lines (66 loc) · 1.77 KB
/
AL06.yml
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
rule: AL06
test_pass_no_config:
pass_str: |
select
x.a,
x_2.b
from x
left join x as x_2 on x.foreign_key = x.foreign_key
test_fail_alias_too_short:
fail_str: |
SELECT
u.id,
c.first_name,
c.last_name,
COUNT(o.user_id)
FROM users as u
JOIN customers as c on u.id = c.user_id
JOIN orders as o on u.id = o.user_id;
configs:
rules:
aliasing.length:
min_alias_length: 4
test_fail_alias_too_long:
fail_str: |
SELECT
u.id,
customers_customers_customers.first_name,
customers_customers_customers.last_name,
COUNT(o.user_id)
FROM users as u
JOIN customers as customers_customers_customers on u.id = customers_customers_customers.user_id
JOIN orders as o on u.id = o.user_id;
configs:
rules:
aliasing.length:
max_alias_length: 10
test_fail_alias_min_and_max:
fail_str: |
SELECT
u.id,
customers_customers_customers.first_name,
customers_customers_customers.last_name,
COUNT(o.user_id)
FROM users as u
JOIN customers as customers_customers_customers on u.id = customers_customers_customers.user_id
JOIN orders as o on u.id = o.user_id;
configs:
rules:
aliasing.length:
min_alias_length: 4
max_alias_length: 10
test_pass_with_config:
pass_str: |
SELECT
users.id,
customers_customers_customers.first_name,
customers_customers_customers.last_name,
COUNT(latest_orders.user_id)
FROM users
JOIN customers as customers_customers_customers on users.id = customers_customers_customers.user_id
JOIN orders as latest_orders on users.id = latest_orders.user_id;
configs:
rules:
aliasing.length:
min_alias_length: 10
max_alias_length: 30