-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jo Lares
authored and
Jo Lares
committed
Feb 24, 2024
1 parent
ca11073
commit a3af509
Showing
14 changed files
with
93 additions
and
36 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
[sqlfluff] | ||
dialect = snowflake | ||
templater = dbt | ||
runaway_limit = 10 | ||
max_line_length = 80 | ||
indent_unit = space | ||
|
||
[sqlfluff:indentation] | ||
tab_space_size = 4 | ||
|
||
[sqlfluff:layout:type:comma] | ||
spacing_before = touch | ||
line_position = trailing | ||
|
||
[sqlfluff:rules:capitalisation.keywords] | ||
capitalisation_policy = lower | ||
|
||
[sqlfluff:rules:aliasing.table] | ||
aliasing = explicit | ||
|
||
[sqlfluff:rules:aliasing.column] | ||
aliasing = explicit | ||
|
||
[sqlfluff:rules:aliasing.expression] | ||
allow_scalar = False | ||
|
||
[sqlfluff:rules:capitalisation.identifiers] | ||
extended_capitalisation_policy = lower | ||
|
||
[sqlfluff:rules:capitalisation.functions] | ||
capitalisation_policy = lower | ||
|
||
[sqlfluff:rules:capitalisation.literals] | ||
capitalisation_policy = lower | ||
|
||
[sqlfluff:rules:ambiguous.column_references] # Number in group by | ||
group_by_and_order_by_style = implicit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
reports | ||
target | ||
dist | ||
dbt_packages | ||
macros |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Formats SQL files | ||
sqlfmt */**/*.sql | ||
|
||
# Formats Python files | ||
# TODO: do not run if there is no python files | ||
# black */**/*.py | ||
|
||
# Format yml files | ||
yamlfix */**/*.y*ml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sqlfluff lint */**/*.sql --dialect $DBT_WAREHOUSE_PROVIDER --disregard-sqlfluffignores |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
|
||
/* | ||
* Welcome to your first dbt model! | ||
* Did you know that you can also configure models directly within SQL files? | ||
* This will override configurations stated in dbt_project.yml | ||
* | ||
* Try changing "table" to "view" below | ||
*/ | ||
{{ config(materialized="table") }} | ||
|
||
{{ config(materialized='table') }} | ||
|
||
WITH source_data AS ( | ||
with | ||
source_data as ( | ||
|
||
SELECT 1 AS id | ||
UNION ALL | ||
SELECT null AS id | ||
select 1 as id | ||
union all | ||
select null as id | ||
|
||
) | ||
) | ||
|
||
SELECT * | ||
FROM source_data | ||
select * | ||
from | ||
source_data | ||
|
||
/* | ||
/* | ||
* Uncomment the line below to remove records WITH null `id` values | ||
*/ | ||
|
||
-- WHERE id IS NOT null | ||
-- WHERE id IS NOT null | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,2 @@ | ||
|
||
-- Use the `ref` function to select from other models | ||
|
||
SELECT * | ||
FROM {{ ref('my_first_dbt_model') }} | ||
WHERE id = 1 | ||
-- Use the `ref` function to SELECT FROM other models | ||
select * from {{ ref("my_first_dbt_model") }} where id = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,15 @@ | ||
|
||
--- | ||
version: 2 | ||
|
||
models: | ||
- name: my_first_dbt_model | ||
description: "A starter dbt model" | ||
description: A starter dbt model | ||
columns: | ||
- name: id | ||
description: "The primary key for this table" | ||
tests: | ||
- unique | ||
|
||
description: The primary key for this table | ||
tests: [unique] | ||
- name: my_second_dbt_model | ||
description: "A starter dbt model" | ||
description: A starter dbt model | ||
columns: | ||
- name: id | ||
description: "The primary key for this table" | ||
tests: | ||
- unique | ||
- not_null | ||
description: The primary key for this table | ||
tests: [unique, not_null] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sqlfluff-templater-dbt==2.3.5 | ||
shandy-sqlfmt[jinjafmt] | ||
black==24.2.0 | ||
yamlfix==1.16.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters