Skip to content

Commit

Permalink
chore: Rewrite query for readability
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Oct 4, 2024
1 parent cf27947 commit 6a34439
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions exporter/management/commands/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,18 @@ def callback(state, channel, method, properties, input_message):
logger.debug("Processing page %s with data.id > %s", page, data_id)
cursor.execute(
"""
SELECT d.id, d.data, d.data->>'date'
FROM compiled_release c
JOIN data d ON (c.data_id = d.id)
WHERE collection_id = %s
AND d.id > %s
ORDER BY d.id
SELECT
data.id,
data,
data ->> 'date'
FROM
compiled_release
JOIN data ON data.id = data_id
WHERE
collection_id = %s
AND data.id > %s
ORDER BY
data.id
LIMIT %s
""",
[collection_id, data_id, settings.EXPORTER_PAGE_SIZE],
Expand Down

0 comments on commit 6a34439

Please sign in to comment.