Skip to content

Commit

Permalink
Fixing bug in SQL
Browse files Browse the repository at this point in the history
  • Loading branch information
schuemie committed Dec 22, 2023
1 parent 1f4b291 commit 8cb3bbe
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cdm_processing/cdm_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ def _create_sequence_tables(self,
sql = "SELECT tokens.*, " \
f"{part1}" \
" ROW_NUMBER() OVER " \
" (PARTITION BY observation_period_id ORDER BY visit_concept_orders, sort_order) - 1 AS orders " \
" (PARTITION BY tokens.observation_period_id ORDER BY visit_concept_orders, sort_order) - 1 " \
" AS orders " \
"FROM (" \
" SELECT * FROM interval_tokens " \
" UNION ALL " \
Expand All @@ -190,7 +191,7 @@ def _create_sequence_tables(self,
" SELECT * FROM end_tokens" \
") tokens " \
f"{part2}" \
"ORDER BY observation_period_id, visit_concept_orders, sort_order"
"ORDER BY tokens.observation_period_id, visit_concept_orders, sort_order"
union_tokens = con.execute(sql).arrow()
con.execute("DROP TABLE visits")
con.execute("DROP TABLE interval_tokens")
Expand Down

0 comments on commit 8cb3bbe

Please sign in to comment.