Skip to content

Commit

Permalink
sqlfluff fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sspaeti committed Nov 17, 2022
1 parent c51ab5b commit 6d63d80
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ renamed as (
resource_requirements,

{{ json_extract_text_custom('schedule', 'timeUnit') }} as time_unit,
{{ json_extract_text_custom('schedule', 'units', 'integer') }} as units
{{ json_extract_text_custom('schedule', 'units', 'integer') }} as units

from source
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,21 @@ attempts_data as (select distinct
updated_at,
ended_at
from attempts_raw_data
), attempts_incl_row_num as ( select
),

attempts_incl_row_num as ( select
sync_unique_key,
job_id,
attempt_id,
failure_reasons,
dt,
row_number() over (partition by sync_unique_key, job_id, attempt_id, temporal_workflow_id order by dt desc, updated_at desc, ended_at desc, loaded_at desc) as seq
row_number() over (
partition by sync_unique_key, job_id, attempt_id, temporal_workflow_id order by dt desc, updated_at desc, ended_at desc, loaded_at desc
) as seq
from attempts_raw_data
), attempts_failure_reasons_data as (
),

attempts_failure_reasons_data as (
select
sync_unique_key,
job_id,
Expand All @@ -54,7 +60,9 @@ attempts_data as (select distinct
dt
from attempts_incl_row_num
where seq = 1
), jobs_data as (
),

jobs_data as (
select distinct
--except(loaded_at, operation_sequence, cpu_request, memory_request)
job_id,
Expand Down
27 changes: 14 additions & 13 deletions transformation_dbt/models/3-mart/mart_sync_success.sql
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
with sync_status as (select * from {{ ref('core_airbyte_sync_status') }} )
SELECT

select
source2destination_name,
count(*) AS total_attempts,
coalesce(sum(CASE WHEN attempt_succeeded THEN 1 ELSE 0 END), 0) AS attempt_succeeded,
coalesce(sum(CASE WHEN attempt_failed THEN 1 ELSE 0 END), 0) AS attempt_failed,
coalesce(sum(CASE WHEN attempt_succeeded_first_attempt THEN 1 ELSE 0 END), 0) AS attempt_succeeded_first_attempt,
coalesce(sum(CASE WHEN attempt_succeeded THEN 1 ELSE 0 END), 0) * 100.0 / count(*) AS success_rate,
coalesce(sum(CASE WHEN attempt_succeeded_first_attempt THEN 1 ELSE 0 END), 0) * 100.0 / count(*) AS success_rate_first_attempt,
coalesce(sum(CASE WHEN attempt_running THEN 1 ELSE 0 END), 0) AS attempt_running,
sum(attempt_duration) AS sum_attempt_duration,
sum(volume_rows) AS sum_volume_rows,
sum(volume_mb) AS sum_volume_mb
count(*) as total_attempts,
coalesce(sum(case when attempt_succeeded then 1 else 0 end), 0) as attempt_succeeded,
coalesce(sum(case when attempt_failed then 1 else 0 end), 0) as attempt_failed,
coalesce(sum(case when attempt_succeeded_first_attempt then 1 else 0 end), 0) as attempt_succeeded_first_attempt,
coalesce(sum(case when attempt_succeeded then 1 else 0 end), 0) * 100.0 / count(*) as success_rate,
coalesce(sum(case when attempt_succeeded_first_attempt then 1 else 0 end), 0) * 100.0 / count(*) as success_rate_first_attempt,
coalesce(sum(case when attempt_running then 1 else 0 end), 0) as attempt_running,
sum(attempt_duration) as sum_attempt_duration,
sum(volume_rows) as sum_volume_rows,
sum(volume_mb) as sum_volume_mb

FROM sync_status
from sync_status

GROUP BY source2destination_name
group by source2destination_name
29 changes: 15 additions & 14 deletions transformation_dbt/models/3-mart/mart_sync_success_day.sql
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
with sync_status as (select * from {{ ref('core_airbyte_sync_status') }} )
SELECT

select
source2destination_name,
date(sync_updated) AS sync_updated,
count(*) AS total_attempts,
coalesce(sum(CASE WHEN attempt_succeeded THEN 1 ELSE 0 END), 0) AS attempt_succeeded,
coalesce(sum(CASE WHEN attempt_failed THEN 1 ELSE 0 END), 0) AS attempt_failed,
coalesce(sum(CASE WHEN attempt_succeeded_first_attempt THEN 1 ELSE 0 END), 0) AS attempt_succeeded_first_attempt,
coalesce(sum(CASE WHEN attempt_succeeded THEN 1 ELSE 0 END), 0) * 100.0 / count(*) AS success_rate,
coalesce(sum(CASE WHEN attempt_succeeded_first_attempt THEN 1 ELSE 0 END), 0) * 100.0 / count(*) AS success_rate_first_attempt,
coalesce(sum(CASE WHEN attempt_running THEN 1 ELSE 0 END), 0) AS attempt_running,
sum(attempt_duration) AS sum_attempt_duration,
sum(volume_rows) AS sum_volume_rows,
sum(volume_mb) AS sum_volume_mb
date(sync_updated) as sync_updated,
count(*) as total_attempts,
coalesce(sum(case when attempt_succeeded then 1 else 0 end), 0) as attempt_succeeded,
coalesce(sum(case when attempt_failed then 1 else 0 end), 0) as attempt_failed,
coalesce(sum(case when attempt_succeeded_first_attempt then 1 else 0 end), 0) as attempt_succeeded_first_attempt,
coalesce(sum(case when attempt_succeeded then 1 else 0 end), 0) * 100.0 / count(*) as success_rate,
coalesce(sum(case when attempt_succeeded_first_attempt then 1 else 0 end), 0) * 100.0 / count(*) as success_rate_first_attempt,
coalesce(sum(case when attempt_running then 1 else 0 end), 0) as attempt_running,
sum(attempt_duration) as sum_attempt_duration,
sum(volume_rows) as sum_volume_rows,
sum(volume_mb) as sum_volume_mb

FROM sync_status
from sync_status

GROUP BY source2destination_name, date(sync_updated)
group by source2destination_name, date(sync_updated)

0 comments on commit 6d63d80

Please sign in to comment.