Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,29 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
rev: v6.0.0
hooks:
- id: trailing-whitespace
exclude: "__snapshots__"
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-json
# The next step only applies if you have javascript files.
# There should be a package.json that installs eslint
# (or eslint-config-react-app if you are using gatsby).
# - repo: https://github.com/pre-commit/mirrors-eslint
# rev: v8.24.0
# hooks:
# - id: eslint
- repo: https://github.com/PyCQA/isort
rev: 5.11.5
rev: 6.0.1
hooks:
- id: isort
- repo: https://github.com/ambv/black
rev: 22.3.0
rev: 25.9.0
hooks:
- id: black
language_version: python3
- repo: https://github.com/PyCQA/flake8
rev: 7.1.0
rev: 7.3.0
hooks:
- id: flake8
- repo: https://github.com/sqlfluff/sqlfluff
rev: 0.10.1
rev: 3.4.2
hooks:
- id: sqlfluff-lint
- id: sqlfluff-fix
12 changes: 8 additions & 4 deletions .sqlfluff
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
[sqlfluff]
dialect=bigquery
indent_unit = space
exclude_rules = L014,L018,L027,L032,L034,L042,L044
exclude_rules = L014,L018,L027,L032,L034,L042,L044,RF01,CV03,RF04
max_line_length = 120

[sqlfluff:rules]
max_line_length = 120
tab_space_size = 2

[sqlfluff:rules:L010]
[sqlfluff:rules:capitalisation.keywords]
capitalisation_policy = upper

[sqlfluff:rules:L030]
extended_capitalisation_policy = upper
[sqlfluff:rules:capitalisation.functions]
capitalisation_policy = lower

[sqlfluff:rules:convention.quoted_literals]
preferred_quoted_literal_style = double_quotes

[sqlfluff:templater:jinja:context]
params = {"staging_dataset": "staging_airtable_to_bq", "production_dataset": "airtable_pipeline_demos", "staging_table_name": "base1_table1", "production_table_name": "base1_table1"}
8 changes: 4 additions & 4 deletions airtable_to_bq.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ def update_staging(dag: DAG, start_task, config: dict):
params={
"staging_dataset": STAGING_DATASET,
"production_dataset": config["production_dataset"],
"staging_table_name": new_table
if config.get("new_query")
else raw_table,
"staging_table_name": (
new_table if config.get("new_query") else raw_table
),
"production_table_name": config["production_table"],
},
)
Expand Down Expand Up @@ -193,7 +193,7 @@ def create_dag(dagname: str, config: dict, parent_dir: str = None) -> DAG:
(presumed shared/general in this case) `config`
:return: Dag that runs an import from airtable to bq
"""
default_args = get_default_args(pocs=["James"])
default_args = get_default_args(pocs=["Daniel"])

dag = DAG(
dagname,
Expand Down
2 changes: 1 addition & 1 deletion bq_to_airtable.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def create_dag(dagname: str, config: dict, parent_dir: str) -> DAG:
(presumed shared/general in this case) `config`
:return: Dag that runs an import from bq to airtable
"""
default_args = get_default_args(pocs=["James"])
default_args = get_default_args(pocs=["Daniel"])

dag = DAG(
dagname,
Expand Down
4 changes: 3 additions & 1 deletion examples/sql/base1_table1_new.sql
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
SELECT * FROM {{ params.staging_dataset }}.{{ params.staging_table_name }} WHERE foo IS NOT NULL
SELECT *
FROM {{ params.staging_dataset }}.{{ params.staging_table_name }}
WHERE foo IS NOT NULL
4 changes: 3 additions & 1 deletion examples/sql/base1_table2_new.sql
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
SELECT * FROM {{ params.staging_dataset }}.{{ params.staging_table_name }} WHERE length(some_notes) > 20
SELECT *
FROM {{ params.staging_dataset }}.{{ params.staging_table_name }}
WHERE length(some_notes) > 20
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[tool.black]
py36 = true
include = '\.pyi?$'
exclude = '''
/(
Expand Down