Skip to content

Commit

Permalink
Simplify dependent zipapps query.
Browse files Browse the repository at this point in the history
  • Loading branch information
jsirois committed Oct 5, 2024
1 parent bdb3f11 commit 91f8c67
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions pex/cache/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,13 @@ def _iter_wheel_dependents(
chunk_size = 250
for index in range(0, len(wheel_install_hashes), chunk_size):
chunk = wheel_install_hashes[index : index + chunk_size]
chunk_placeholder = ", ".join(itertools.repeat("?", len(chunk)))
chunk_placeholders = ", ".join(itertools.repeat("?", len(chunk)))
with closing(
conn.execute(
"""
SELECT DISTINCT zipapps.pex_hash FROM zipapps
JOIN zipapp_deps ON zipapp_deps.pex_hash = zipapps.pex_hash
WHERE zipapp_deps.wheel_install_hash IN ({chunk})
SELECT DISTINCT pex_hash FROM zipapp_deps WHERE wheel_install_hash IN ({chunk})
""".format(
chunk=chunk_placeholder
chunk=chunk_placeholders
),
chunk,
)
Expand All @@ -234,7 +232,7 @@ def _iter_wheel_dependents(
JOIN venv_deps ON venv_deps.venv_hash = venvs.short_hash
WHERE venv_deps.wheel_install_hash IN ({chunk})
""".format(
chunk=chunk_placeholder
chunk=chunk_placeholders
),
chunk,
)
Expand Down

0 comments on commit 91f8c67

Please sign in to comment.