Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#1305)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.6.5 → v0.6.7](astral-sh/ruff-pre-commit@v0.6.5...v0.6.7)
- [github.com/sqlfluff/sqlfluff: 3.1.1 → 3.2.0](sqlfluff/sqlfluff@3.1.1...3.2.0)

* fix RF02 unreferenced subquery column in IRX models

* fix RF02 unreferenced subquery column in IRX models - more

* more fixes to RF02 unqualified reference errors on staging and intermediate models

* one PRS fix

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Rachel Lougee <[email protected]>
  • Loading branch information
pre-commit-ci[bot] and rachellougee authored Sep 24, 2024
1 parent e982a86 commit cc50771
Show file tree
Hide file tree
Showing 23 changed files with 86 additions and 40 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ repos:
- --exclude-files poetry.lock
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: 'v0.6.5'
rev: 'v0.6.7'
hooks:
- id: ruff-format
- id: ruff
Expand All @@ -60,7 +60,7 @@ repos:
- types-pymysql
- types-requests
- repo: https://github.com/sqlfluff/sqlfluff
rev: 3.1.1
rev: 3.2.0
hooks:
- id: sqlfluff-fix
# Arbitrary arguments to show an example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ select
, student_item_id
from {{ source('ol_warehouse_raw_data','raw__mitx__openedx__mysql__submissions_score') }}
where student_item_id in (
select id from {{ source('ol_warehouse_raw_data','raw__mitx__openedx__mysql__submissions_studentitem') }}
select studentitem.id
from {{ source('ol_warehouse_raw_data','raw__mitx__openedx__mysql__submissions_studentitem') }} as studentitem
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ select
, student_item_id
from {{ source('ol_warehouse_raw_data','raw__mitx__openedx__mysql__submissions_scoresummary') }}
where student_item_id in (
select id from {{ source('ol_warehouse_raw_data','raw__mitx__openedx__mysql__submissions_studentitem') }}
select studentitem.id
from {{ source('ol_warehouse_raw_data','raw__mitx__openedx__mysql__submissions_studentitem') }} as studentitem
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ select
, id
from {{ source('ol_warehouse_raw_data','raw__mitx__openedx__mysql__submissions_submission') }}
where student_item_id in (
select id from {{ source('ol_warehouse_raw_data','raw__mitx__openedx__mysql__submissions_studentitem') }}
select studentitem.id
from {{ source('ol_warehouse_raw_data','raw__mitx__openedx__mysql__submissions_studentitem') }} as studentitem
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ select
, assessment_completed_at
from {{ source('ol_warehouse_raw_data','raw__mitx__openedx__mysql__workflow_assessmentworkflowstep') }}
where workflow_id in (
select id from {{ source('ol_warehouse_raw_data','raw__mitx__openedx__mysql__workflow_assessmentworkflow') }}
select assessmentworkflow.id
from
{{ source('ol_warehouse_raw_data','raw__mitx__openedx__mysql__workflow_assessmentworkflow') }}
as assessmentworkflow
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ select
, student_item_id
from {{ source('ol_warehouse_raw_data','raw__mitxonline__openedx__mysql__submissions_score') }}
where student_item_id in (
select id from {{ source('ol_warehouse_raw_data','raw__mitxonline__openedx__mysql__submissions_studentitem') }}
select studentitem.id
from {{ source('ol_warehouse_raw_data','raw__mitxonline__openedx__mysql__submissions_studentitem') }} as studentitem
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ select
, student_item_id
from {{ source('ol_warehouse_raw_data','raw__mitxonline__openedx__mysql__submissions_scoresummary') }}
where student_item_id in (
select id from {{ source('ol_warehouse_raw_data','raw__mitxonline__openedx__mysql__submissions_studentitem') }}
select studentitem.id
from {{ source('ol_warehouse_raw_data','raw__mitxonline__openedx__mysql__submissions_studentitem') }} as studentitem
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ select
, id
from {{ source('ol_warehouse_raw_data','raw__mitxonline__openedx__mysql__submissions_submission') }}
where student_item_id in (
select id from {{ source('ol_warehouse_raw_data','raw__mitxonline__openedx__mysql__submissions_studentitem') }}
select studentitem.id
from {{ source('ol_warehouse_raw_data','raw__mitxonline__openedx__mysql__submissions_studentitem') }} as studentitem
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ select
, assessment_completed_at
from {{ source('ol_warehouse_raw_data','raw__mitxonline__openedx__mysql__workflow_assessmentworkflowstep') }}
where workflow_id in (
select id from {{ source('ol_warehouse_raw_data','raw__mitxonline__openedx__mysql__workflow_assessmentworkflow') }}
select assessmentworkflow.id
from
{{ source('ol_warehouse_raw_data','raw__mitxonline__openedx__mysql__workflow_assessmentworkflow') }}
as assessmentworkflow
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ select
, student_item_id
from {{ source('ol_warehouse_raw_data','raw__xpro__openedx__mysql__submissions_score') }}
where student_item_id in (
select id from {{ source('ol_warehouse_raw_data','raw__xpro__openedx__mysql__submissions_studentitem') }}
select studentitem.id
from {{ source('ol_warehouse_raw_data','raw__xpro__openedx__mysql__submissions_studentitem') }} as studentitem
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ select
, student_item_id
from {{ source('ol_warehouse_raw_data','raw__xpro__openedx__mysql__submissions_scoresummary') }}
where student_item_id in (
select id from {{ source('ol_warehouse_raw_data','raw__xpro__openedx__mysql__submissions_studentitem') }}
select studentitem.id
from {{ source('ol_warehouse_raw_data','raw__xpro__openedx__mysql__submissions_studentitem') }} as studentitem
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ select
, id
from {{ source('ol_warehouse_raw_data','raw__xpro__openedx__mysql__submissions_submission') }}
where student_item_id in (
select id from {{ source('ol_warehouse_raw_data','raw__xpro__openedx__mysql__submissions_studentitem') }}
select studentitem.id
from {{ source('ol_warehouse_raw_data','raw__xpro__openedx__mysql__submissions_studentitem') }} as studentitem
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ select
, assessment_completed_at
from {{ source('ol_warehouse_raw_data','raw__xpro__openedx__mysql__workflow_assessmentworkflowstep') }}
where workflow_id in (
select id from {{ source('ol_warehouse_raw_data','raw__xpro__openedx__mysql__workflow_assessmentworkflow') }}
select assessmentworkflow.id
from
{{ source('ol_warehouse_raw_data','raw__xpro__openedx__mysql__workflow_assessmentworkflow') }}
as assessmentworkflow
)
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ with lines as (
from {{ ref('stg__mitxonline__app__postgres__reversion_version') }}
where
contenttype_id in (
select contenttype_id
select contenttypes.contenttype_id
from
contenttypes
where contenttype_full_name = 'ecommerce_product'
where contenttypes.contenttype_full_name = 'ecommerce_product'
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,16 @@ with program_requirements as (
, sum(electiveset_required_number) as program_num_elective_courses
from (
select
program_id
, programrequirement_requirement_id
, avg(electiveset_required_number) as electiveset_required_number
combined_requirements.program_id
, combined_requirements.programrequirement_requirement_id
, avg(combined_requirements.electiveset_required_number) as electiveset_required_number
from combined_requirements
where
programrequirement_type = 'Elective'
and programrequirement_is_a_nested_requirement = false
group by program_id, programrequirement_requirement_id
combined_requirements.programrequirement_type = 'Elective'
and combined_requirements.programrequirement_is_a_nested_requirement = false
group by
combined_requirements.program_id
, combined_requirements.programrequirement_requirement_id
) group by program_id

)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@ with products as (
select * from
(
select
*
, row_number() over (partition by product_id order by productversion_updated_on desc) as row_num
from {{ ref('int__mitxpro__ecommerce_productversion') }}
productversion.*
, row_number() over (
partition by productversion.product_id
order by productversion.productversion_updated_on desc
) as row_num
from {{ ref('int__mitxpro__ecommerce_productversion') }} as productversion
) as product
where row_num = 1
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ with ecommerce_product as (
select *
from (
select
*
, rank() over (partition by product_id order by productversion_updated_on desc) as myrank
ecommerce_productversion.*
, rank() over (
partition by ecommerce_productversion.product_id
order by ecommerce_productversion.productversion_updated_on desc
) as myrank
from ecommerce_productversion
) as a
where myrank = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ with source as (
, cert_status as courseruncertificate_status
, coalesce(is_active = 1, false) as courserunenrollment_is_active
--- trino doesn't have function to convert first letter to upper case
, regexp_replace(
, regexp_replace( -- noqa: PRS
{{ transform_gender_value('gender') }}, '(^[a-z])(.)', x -> upper(x[1]) || x[2] -- noqa
) as user_gender
,{{ transform_education_value('loe') }} as user_highest_education
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ with source as (
, certificate_name as courseruncertificate_name
, certificate_status as courseruncertificate_status
--- trino doesn't have function to convert first letter to upper case
, regexp_replace(
, regexp_replace( -- noqa: PRS
{{ transform_gender_value('profile_gender') }}, '(^[a-z])(.)', x -> upper(x[1]) || x[2] -- noqa
) as user_gender
,{{ transform_education_value('profile_level_of_education') }} as user_highest_education
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ with course_block_source as (
, course_block as (
select * from (
select
*
course_block_source.*
, lag(
course_content_hash) over
(partition by block_id, course_id order by retrieved_at asc) as previous_content_hash
course_block_source.course_content_hash)
over
(
partition by course_block_source.block_id, course_block_source.course_id
order by course_block_source.retrieved_at asc
)
as previous_content_hash
from course_block_source
)
where previous_content_hash is null or previous_content_hash != course_content_hash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ with course_block_source as (
, course_block as (
select * from (
select
*
, lag(
course_content_hash) over
(partition by block_id, course_id order by retrieved_at asc) as previous_content_hash
course_block_source.*
, lag(course_block_source.course_content_hash) over (
partition by
course_block_source.block_id
, course_block_source.course_id
order by course_block_source.retrieved_at asc
) as previous_content_hash
from course_block_source
)
where previous_content_hash is null or previous_content_hash != course_content_hash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@ with course_block_source as (
, course_block as (
select * from (
select
*
, lag(course_content_hash) over (partition by block_id, course_id order by retrieved_at asc)
course_block_source.*
, lag(course_block_source.course_content_hash)
over (
partition by
course_block_source.block_id
, course_block_source.course_id
order by course_block_source.retrieved_at asc
)
as previous_content_hash
from course_block_source
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@ with course_block_source as (
, course_block as (
select * from (
select
*
, lag(course_content_hash) over (partition by block_id, course_id order by retrieved_at asc)
course_block_source.*
, lag(course_block_source.course_content_hash)
over (
partition by
course_block_source.block_id
, course_block_source.course_id
order by course_block_source.retrieved_at asc
)
as previous_content_hash
from course_block_source
)
Expand Down

0 comments on commit cc50771

Please sign in to comment.