Skip to content

Commit

Permalink
Merge pull request #7 from opt-nc/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
mbarre authored Apr 14, 2024
2 parents e301bfc + 77bf495 commit 8d88c24
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check_data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
uses: actions/checkout@v4

- name: ⚙️ Install DuckDB
uses: opt-nc/[email protected].7
uses: opt-nc/[email protected].8
with:
version: ${{ vars.VERSION_DUCKDB}}

Expand Down
4 changes: 2 additions & 2 deletions data/acronyms_optnc.csv
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@
"SG","Secrétariat Général."
"SGLB","Secrétariat Général Logistique et Bâtiments."
"SI","Section Intervention / Système d’Information."
"SI MOBILE","Système d’Information du réseau mobile."
"SI TELECOMS","Système d’Information Télécoms."
"SID","Système d’Information Décisionnel."
"SIG","Système d’Information Géographique."
"SI MOBILE","Système d’Information du réseau mobile."
"SIRH","Système d’Information des Ressources Humaines."
"SI TELECOMS","Système d’Information Télécoms."
"SLA","Service Level Agreement - Engagement de niveau de service."
"ST","Sous-Traité."
"SVA","Service à Valeur Ajoutée."
Expand Down
16 changes: 11 additions & 5 deletions duck.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ CREATE SEQUENCE seq_sorted START 1;

create or replace temp table orig_table as
select nextval('seq_original') as index,
id_acronym from acronyms;
id_acronym, description from acronyms;

create or replace temp table sorted_table as
select nextval('seq_sorted') as index,
id_acronym
from (select id_acronym from acronyms order by id_acronym);
id_acronym, description
from (select id_acronym, description from acronyms order by id_acronym, description);

-- Check the resulting tables
from orig_table;
from sorted_table;

-- Create the table that compares the sorted and original tables columns
create or replace temp table test_sorted(orig_id_acronym varchar,
create or replace temp table test_sorted(orig_id_acronym varchar, orig_description varchar,
orig_index integer,
sorted_index integer
-- the magic part XD
Expand All @@ -46,11 +46,17 @@ create or replace temp table test_sorted(orig_id_acronym varchar,
insert into test_sorted
select
orig_table.id_acronym as orig_id_acronym,
orig_table.description as orig_description,
orig_table.index as orig_index,
sorted_table.index as sorted_index,
from
orig_table,
sorted_table
where
orig_table.id_acronym = sorted_table.id_acronym
order by orig_table.index;
and orig_table.description = sorted_table.description
order by orig_table.index;

-- Check the resulting table
-- from test_sorted
-- where orig_index != sorted_index;

0 comments on commit 8d88c24

Please sign in to comment.