Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ SQL >
(
platform IN ('git', 'gerrit', 'github', 'gitlab')
AND (channel, activityRelations_bucket_MV_ds_0.segmentId) IN (
SELECT r.url, r.segmentId
FROM repositories r FINAL
INNER JOIN insightsProjects i FINAL ON r.insightsProjectId = i.id
WHERE isNull (r.deletedAt) AND isNull (i.deletedAt) AND r.enabled = true
SELECT channel, segmentId FROM repos_to_channels
)
)
OR platform NOT IN ('git', 'gerrit', 'github', 'gitlab')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ SQL >
(
platform IN ('git', 'gerrit', 'github', 'gitlab')
AND (channel, activityRelations_bucket_MV_ds_1.segmentId) IN (
SELECT r.url, r.segmentId
FROM repositories r FINAL
INNER JOIN insightsProjects i FINAL ON r.insightsProjectId = i.id
WHERE isNull (r.deletedAt) AND isNull (i.deletedAt) AND r.enabled = true
SELECT channel, segmentId FROM repos_to_channels
)
)
OR platform NOT IN ('git', 'gerrit', 'github', 'gitlab')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ SQL >
(
platform IN ('git', 'gerrit', 'github', 'gitlab')
AND (channel, activityRelations_bucket_MV_ds_2.segmentId) IN (
SELECT r.url, r.segmentId
FROM repositories r FINAL
INNER JOIN insightsProjects i FINAL ON r.insightsProjectId = i.id
WHERE isNull (r.deletedAt) AND isNull (i.deletedAt) AND r.enabled = true
SELECT channel, segmentId FROM repos_to_channels
)
)
OR platform NOT IN ('git', 'gerrit', 'github', 'gitlab')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ SQL >
(
platform IN ('git', 'gerrit', 'github', 'gitlab')
AND (channel, activityRelations_bucket_MV_ds_3.segmentId) IN (
SELECT r.url, r.segmentId
FROM repositories r FINAL
INNER JOIN insightsProjects i FINAL ON r.insightsProjectId = i.id
WHERE isNull (r.deletedAt) AND isNull (i.deletedAt) AND r.enabled = true
SELECT channel, segmentId FROM repos_to_channels
)
)
OR platform NOT IN ('git', 'gerrit', 'github', 'gitlab')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ SQL >
(
platform IN ('git', 'gerrit', 'github', 'gitlab')
AND (channel, activityRelations_bucket_MV_ds_4.segmentId) IN (
SELECT r.url, r.segmentId
FROM repositories r FINAL
INNER JOIN insightsProjects i FINAL ON r.insightsProjectId = i.id
WHERE isNull (r.deletedAt) AND isNull (i.deletedAt) AND r.enabled = true
SELECT channel, segmentId FROM repos_to_channels
)
)
OR platform NOT IN ('git', 'gerrit', 'github', 'gitlab')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ SQL >
(
platform IN ('git', 'gerrit', 'github', 'gitlab')
AND (channel, activityRelations_bucket_MV_ds_5.segmentId) IN (
SELECT r.url, r.segmentId
FROM repositories r FINAL
INNER JOIN insightsProjects i FINAL ON r.insightsProjectId = i.id
WHERE isNull (r.deletedAt) AND isNull (i.deletedAt) AND r.enabled = true
SELECT channel, segmentId FROM repos_to_channels
)
)
OR platform NOT IN ('git', 'gerrit', 'github', 'gitlab')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ SQL >
(
platform IN ('git', 'gerrit', 'github', 'gitlab')
AND (channel, activityRelations_bucket_MV_ds_6.segmentId) IN (
SELECT r.url, r.segmentId
FROM repositories r FINAL
INNER JOIN insightsProjects i FINAL ON r.insightsProjectId = i.id
WHERE isNull (r.deletedAt) AND isNull (i.deletedAt) AND r.enabled = true
SELECT channel, segmentId FROM repos_to_channels
)
)
OR platform NOT IN ('git', 'gerrit', 'github', 'gitlab')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ SQL >
(
platform IN ('git', 'gerrit', 'github', 'gitlab')
AND (channel, activityRelations_bucket_MV_ds_7.segmentId) IN (
SELECT r.url, r.segmentId
FROM repositories r FINAL
INNER JOIN insightsProjects i FINAL ON r.insightsProjectId = i.id
WHERE isNull (r.deletedAt) AND isNull (i.deletedAt) AND r.enabled = true
SELECT channel, segmentId FROM repos_to_channels
)
)
OR platform NOT IN ('git', 'gerrit', 'github', 'gitlab')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ SQL >
(
platform IN ('git', 'gerrit', 'github', 'gitlab')
AND (channel, activityRelations_bucket_MV_ds_8.segmentId) IN (
SELECT r.url, r.segmentId
FROM repositories r FINAL
INNER JOIN insightsProjects i FINAL ON r.insightsProjectId = i.id
WHERE isNull (r.deletedAt) AND isNull (i.deletedAt) AND r.enabled = true
SELECT channel, segmentId FROM repos_to_channels
)
)
OR platform NOT IN ('git', 'gerrit', 'github', 'gitlab')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ SQL >
(
platform IN ('git', 'gerrit', 'github', 'gitlab')
AND (channel, activityRelations_bucket_MV_ds_9.segmentId) IN (
SELECT r.url, r.segmentId
FROM repositories r FINAL
INNER JOIN insightsProjects i FINAL ON r.insightsProjectId = i.id
WHERE isNull (r.deletedAt) AND isNull (i.deletedAt) AND r.enabled = true
SELECT channel, segmentId FROM repos_to_channels
)
)
OR platform NOT IN ('git', 'gerrit', 'github', 'gitlab')
Expand Down
23 changes: 13 additions & 10 deletions services/libs/tinybird/pipes/repos_to_channels.pipe
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ DESCRIPTION >
- Parameters:
- `repos`: Optional array of repository URLs to expand. If not provided, defaults to all enabled repositories.
- `excluded`: Optional boolean. When true, expands excluded repositories instead of enabled ones. Used to build exclusion filters.
- Response: `channel` - all possible channel URL formats for the given repos
- Response: `channel` - all possible channel URL formats for the given repos; `segmentId` - segment the repo belongs to (empty string when repos param is provided)
Comment thread
joanagmaia marked this conversation as resolved.

TAGS "Repository URLs", "Gerrit"

Expand All @@ -20,13 +20,15 @@ SQL >
SELECT
arrayJoin(
{{ Array(repos, 'String', description="Repository URLs to expand", required=False) }}
) AS url
) AS url,
'' AS segmentId
{% else %}
SELECT url
FROM repositories FINAL
SELECT r.url, r.segmentId
FROM repositories r FINAL
INNER JOIN insightsProjects i FINAL ON r.insightsProjectId = i.id
WHERE
isNull (deletedAt) AND enabled = true
{% if defined(excluded) and excluded %} AND excluded = true
isNull (r.deletedAt) AND r.enabled = true AND isNull (i.deletedAt)
{% if defined(excluded) and excluded %} AND r.excluded = true
{% end %}
{% end %}

Expand All @@ -35,7 +37,7 @@ DESCRIPTION >
Identify Gerrit repositories by joining with integrations table

SQL >
SELECT r.url
SELECT r.url, r.segmentId
Comment thread
cursor[bot] marked this conversation as resolved.
Outdated
FROM repositories r FINAL
JOIN integrations i FINAL ON r.sourceIntegrationId = i.id
WHERE i.platform = 'gerrit' AND isNull (r.deletedAt) AND r.url IN (SELECT url FROM repos_to_expand)
Expand All @@ -46,7 +48,7 @@ DESCRIPTION >

SQL >
-- Original URLs (all repos)
SELECT url AS channel
SELECT url AS channel, segmentId
FROM repos_to_expand
UNION ALL
-- Gerrit channel variants: insert q/project: after the base path
Expand All @@ -67,12 +69,13 @@ SQL >
'/q/project:',
if(path(url) = '/', '', substring(path(url), 2))
)
END AS channel
END AS channel,
segmentId
FROM gerrit_repos

NODE channels_deduplicated
DESCRIPTION >
Final deduplicated list of all possible channel URLs

SQL >
SELECT DISTINCT channel FROM expanded_urls
SELECT DISTINCT channel, segmentId FROM expanded_urls
Loading