Skip to content

Commit a2963db

Browse files
authored
feat: reflecting changes to collections in tinybird & formatting (IN-997) (#3893)
Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
1 parent bd9c156 commit a2963db

25 files changed

Lines changed: 39 additions & 61 deletions

services/libs/tinybird/datasources/collections.datasource

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ DESCRIPTION >
88
- `description` provides additional details about the collection's purpose (empty string if not provided).
99
- `categoryId` links to the category this collection belongs to (empty string if no category association).
1010
- `starred` indicates whether this collection is featured or highlighted (Bool, 0 default for not starred).
11+
- `isPrivate` indicates whether this collection is private (Bool, 0 default for public).
12+
- `ssoUserId` links to the SSO user who created this community collection (Nullable, null for curated collections).
13+
- `logoUrl` is the URL of the collection's logo image (empty string if not provided).
1114
- `createdAt` and `updatedAt` are standard timestamp fields for record lifecycle tracking.
1215

1316
TAGS "Project collections"
@@ -19,6 +22,9 @@ SCHEMA >
1922
`description` String `json:$.record.description` DEFAULT '',
2023
`categoryId` String `json:$.record.categoryId` DEFAULT '',
2124
`starred` Bool `json:$.record.starred` DEFAULT 0,
25+
`isPrivate` Bool `json:$.record.isPrivate` DEFAULT 0,
26+
`ssoUserId` Nullable(String) `json:$.record.ssoUserId`,
27+
`logoUrl` String `json:$.record.logoUrl` DEFAULT '',
2228
`createdAt` DateTime64(3) `json:$.record.createdAt`,
2329
`updatedAt` DateTime64(3) `json:$.record.updatedAt`,
2430
`deletedAt` Nullable(DateTime64(3)) `json:$.record.deletedAt`

services/libs/tinybird/pipes/activities_filtered.pipe

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ SQL >
3232
AND a.timestamp
3333
< {{ DateTime(endDate, description="Filter activity timestamp before", required=False) }}
3434
{% end %}
35-
{% if defined(repos) %}
36-
AND a.channel IN (SELECT channel FROM repos_to_channels)
37-
{% end %}
35+
{% if defined(repos) %} AND a.channel IN (SELECT channel FROM repos_to_channels) {% end %}
3836
{% if defined(platform) %}
3937
AND a.platform
4038
= {{ String(platform, description="Filter activity platform", required=False) }}

services/libs/tinybird/pipes/activities_filtered_historical_cutoff.pipe

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ SQL >
3434
AND a.timestamp
3535
< {{ DateTime(endDate, description="Filter activity timestamp before", required=False) }}
3636
{% end %}
37-
{% if defined(repos) %}
38-
AND a.channel IN (SELECT channel FROM repos_to_channels)
39-
{% end %}
37+
{% if defined(repos) %} AND a.channel IN (SELECT channel FROM repos_to_channels) {% end %}
4038
{% if defined(platform) %}
4139
AND a.platform
4240
= {{ String(platform, description="Filter activity platform", required=False) }}

services/libs/tinybird/pipes/activities_filtered_retention.pipe

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ SQL >
5050
AND a.timestamp
5151
< {{ DateTime(endDate, description="Filter activity timestamp before", required=False) }}
5252
{% end %}
53-
{% if defined(repos) %}
54-
AND a.channel IN (SELECT channel FROM repos_to_channels)
55-
{% end %}
53+
{% if defined(repos) %} AND a.channel IN (SELECT channel FROM repos_to_channels) {% end %}
5654
{% if defined(platform) %}
5755
AND a.platform
5856
= {{ String(platform, description="Filter activity platform", required=False) }}

services/libs/tinybird/pipes/activityTypes_by_project.pipe

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ SQL >
1919
INNER JOIN activityTypes at ON a.type = at.activityType AND a.platform = at.platform
2020
WHERE
2121
a.segmentId = (SELECT segmentId FROM segments_filtered)
22-
{% if defined(repos) %}
23-
AND a.channel IN (SELECT channel FROM repos_to_channels)
24-
{% end %}
22+
{% if defined(repos) %} AND a.channel IN (SELECT channel FROM repos_to_channels) {% end %}
2523
AND (a.type, a.platform) IN (SELECT activityType, platform FROM activityTypes_filtered)
2624
ORDER BY activityType, platform

services/libs/tinybird/pipes/activity_heatmap_by_weekday_and_2hours_blocks.pipe

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ SQL >
2727
AND a.timestamp
2828
< {{ DateTime(endDate, description="Filter activity timestamp before", required=False) }}
2929
{% end %}
30-
{% if defined(repos) %}
31-
AND a.channel IN (SELECT channel FROM repos_to_channels)
32-
{% end %}
30+
{% if defined(repos) %} AND a.channel IN (SELECT channel FROM repos_to_channels) {% end %}
3331
group by weekday, two_hours_block
3432

3533
NODE weekday_hours

services/libs/tinybird/pipes/categories_oss_index.pipe

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ DESCRIPTION >
4343
Returns only needed columns from collections
4444

4545
SQL >
46-
SELECT collections.id, collections.name FROM collections FINAL where isNull (deletedAt)
46+
SELECT collections.id, collections.name
47+
FROM collections FINAL
48+
where isNull (deletedAt) AND isNull (ssoUserId)
4749

4850
NODE categories_oss_index_projects_ranked_by_category
4951
DESCRIPTION >

services/libs/tinybird/pipes/category_groups_oss_index.pipe

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ DESCRIPTION >
4040
Returns only columns we need from collections table
4141

4242
SQL >
43-
SELECT collections.id, collections.name FROM collections FINAL where isNull (deletedAt)
43+
SELECT collections.id, collections.name
44+
FROM collections FINAL
45+
where isNull (deletedAt) AND isNull (ssoUserId)
4446

4547
NODE category_groups_oss_index_projects_ranked_by_category_group
4648
DESCRIPTION >

services/libs/tinybird/pipes/collections_filtered.pipe

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ SQL >
1515
on collectionsInsightsProjects.collectionId = collections.id
1616
and isNull (collectionsInsightsProjects.deletedAt)
1717
where
18-
isNull (collections.deletedAt)
18+
isNull (collections.deletedAt) AND isNull (collections.ssoUserId)
1919
{% if defined(slug) %}
2020
AND collections.slug
2121
= {{ String(slug, description="Filter collection by slug", required=False) }}
@@ -51,4 +51,7 @@ SQL >
5151
collections.createdAt,
5252
collections.updatedAt,
5353
collections.deletedAt,
54-
collections.starred
54+
collections.starred,
55+
collections.isPrivate,
56+
collections.ssoUserId,
57+
collections.logoUrl

services/libs/tinybird/pipes/collections_oss_index.pipe

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ SQL >
9191
FROM collections FINAL
9292
WHERE
9393
isNull (collections.deletedAt)
94+
AND isNull (collections.ssoUserId)
9495
and collections.categoryId IN (SELECT id from collections_oss_index_category_ids)
9596

9697
NODE collections_oss_index_top_projects

0 commit comments

Comments
 (0)