Skip to content

Commit

Permalink
Change ranges query to between instead of isin
Browse files Browse the repository at this point in the history
There are strange gaps in the precompute_urs_id which trip the current approach up
  • Loading branch information
afg1 committed Oct 9, 2023
1 parent 860611f commit fabb378
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rnacentral_pipeline/rnacentral/precompute/ranges.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import csv

import psycopg2
from pypika import Query, Table, Field
from pypika import Field, Query, Table
from pypika import functions as fn


Expand All @@ -28,7 +28,7 @@ def upi_taxid_ranges(ranges, tablename, db_url):
query = (
Query.from_(table)
.select(fn.Min(table.id), fn.Max(table.id))
.where(table.precompute_urs_id.isin([start, stop]))
.where(table.precompute_urs_id.between([start, stop]))
)

cur.execute(str(query), ((start, stop),))
Expand Down

0 comments on commit fabb378

Please sign in to comment.