Skip to content

Commit

Permalink
Merge pull request #122 from mbta/rr-add-transaction_origin_dimension
Browse files Browse the repository at this point in the history
Added ODS Tables:
cubic/ods_qlik/CCH_STAGE.CATEGORIZATION_RULE/
cubic/ods_qlik/CCH_STAGE.CATEGORY/
cubic/ods_qlik/CCH_STAGE.REPROCESS_ACTION/
cubic/ods_qlik/CCH_STAGE.TRANSACTION_TYPE/
cubic/ods_qlik/EDW.CASHBOX_EVENT_DIMENSION/
cubic/ods_qlik/EDW.CHGBK_ACTIVITY_TYPE_DIMENSION/
cubic/ods_qlik/EDW.PASS_LIAB_EVENT_TYPE_DIMENSION/
cubic/ods_qlik/EDW.PURSE_TYPE_DIMENSION/
cubic/ods_qlik/EDW.TRANSACTION_ORIGIN_DIMENSION/
  • Loading branch information
rymarczy authored Nov 5, 2024
2 parents 7a596b1 + cdd4b64 commit 24b7ce8
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/report-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ jobs:
- run: mkdir -p ${{ runner.temp }}/cover
- run: echo Fetching artifacts for ${{ github.event.workflow_run.id }}, event name ${{ github.event_name }}, triggered by ${{ github.event.workflow_run.event }}
- name: Download artifact
uses: actions/github-script@v3.1.0
uses: actions/github-script@v7.0.1
with:
script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "elixir-lcov"
})[0];
var download = await github.actions.downloadArtifact({
var download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
defmodule ExCubicIngestion.Repo.Migrations.AddEvenMoreOdsTables do
use Ecto.Migration

alias ExCubicIngestion.Repo
alias ExCubicIngestion.Schema.CubicTable
alias ExCubicIngestion.Schema.CubicOdsTableSnapshot

@ods_tables [
%{
name: "cubic_ods_qlik__cch_stage_categorization_rule",
s3_prefix: "cubic/ods_qlik/CCH_STAGE.CATEGORIZATION_RULE/"
},
%{
name: "cubic_ods_qlik__cch_stage_category",
s3_prefix: "cubic/ods_qlik/CCH_STAGE.CATEGORY/"
},
%{
name: "cubic_ods_qlik__cch_stage_reprocess_action",
s3_prefix: "cubic/ods_qlik/CCH_STAGE.REPROCESS_ACTION/"
},
%{
name: "cubic_ods_qlik__cch_stage_transaction_type",
s3_prefix: "cubic/ods_qlik/CCH_STAGE.TRANSACTION_TYPE/"
},
%{
name: "cubic_ods_qlik__edw_cashbox_event_dimension",
s3_prefix: "cubic/ods_qlik/EDW.CASHBOX_EVENT_DIMENSION/"
},
%{
name: "cubic_ods_qlik__edw_chgbk_activity_type_dimension",
s3_prefix: "cubic/ods_qlik/EDW.CHGBK_ACTIVITY_TYPE_DIMENSION/"
},
%{
name: "cubic_ods_qlik__edw_pass_liab_event_type_dimension",
s3_prefix: "cubic/ods_qlik/EDW.PASS_LIAB_EVENT_TYPE_DIMENSION/"
},
%{
name: "cubic_ods_qlik__edw_purse_type_dimension",
s3_prefix: "cubic/ods_qlik/EDW.PURSE_TYPE_DIMENSION/"
},
%{
name: "cubic_ods_qlik__edw_transaction_origin_dimension",
s3_prefix: "cubic/ods_qlik/EDW.TRANSACTION_ORIGIN_DIMENSION/"
}
]

def up do
Repo.transaction(fn ->
Enum.each(@ods_tables, fn ods_table ->
ods_table_rec = Repo.insert!(%CubicTable{
name: ods_table[:name],
s3_prefix: ods_table[:s3_prefix],
is_active: true,
is_raw: true
})
Repo.insert!(%CubicOdsTableSnapshot{
table_id: ods_table_rec.id,
snapshot_s3_key: "#{ods_table[:s3_prefix]}LOAD00000001.csv.gz"
})
end)
end)
end

def down do
Repo.transaction(fn ->
Enum.each(@ods_tables, fn ods_table ->
ods_table_rec = CubicTable.get_by!(name: ods_table[:name])
Repo.delete!(ods_table_rec)
Repo.delete!(CubicOdsTableSnapshot.get_by!(table_id: ods_table_rec.id))
end)
end)
end
end

0 comments on commit 24b7ce8

Please sign in to comment.