Skip to content

Commit

Permalink
Query line_item_ids within a collection/package
Browse files Browse the repository at this point in the history
  • Loading branch information
cavis committed Sep 13, 2024
1 parent f89d8cb commit f2320cd
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/query-jobs/boostr_impressions.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@
export default async function job(config) {
const query = `
SELECT
FORMAT_TIMESTAMP("%m/%d/%Y", timestamp) AS Date,
external_id AS \`Ad Server Line\`,
count(*) AS Impressions
FROM ${process.env.BIGQUERY_DATASET}.dt_impressions
INNER JOIN ${process.env.BIGQUERY_DATASET}.flights ON (flight_id = id)
WHERE timestamp >= ?
AND timestamp < ?
AND is_duplicate = false
AND creative_id IS NOT NULL
AND integration_id IN (${config.integrationIds.join(", ")})
FORMAT_TIMESTAMP("%m/%d/%Y", i.timestamp) AS Date,
COALESCE(x.external_id, f.external_id) AS \`Ad Server Line\`,
COUNT(*) AS Impressions
FROM ${process.env.BIGQUERY_DATASET}.dt_impressions i
INNER JOIN ${process.env.BIGQUERY_DATASET}.flights f ON (i.flight_id = f.id)
LEFT JOIN ${process.env.BIGQUERY_DATASET}.flight_collection_external_ids x ON (f.id = x.flight_id AND i.feeder_podcast = x.podcast_id)

Check failure on line 14 in src/query-jobs/boostr_impressions.js

View workflow job for this annotation

GitHub Actions / check-javascript

Replace `process.env.BIGQUERY_DATASET` with `⏎······process.env.BIGQUERY_DATASET⏎····`
WHERE i.timestamp >= ?
AND i.timestamp < ?
AND i.is_duplicate = FALSE
AND i.creative_id IS NOT NULL
AND f.integration_id IN (${config.integrationIds.join(", ")})
GROUP BY Date, \`Ad Server Line\`
ORDER BY Date ASC, \`Ad Server Line\` ASC
`;
Expand Down

0 comments on commit f2320cd

Please sign in to comment.