Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 3 additions & 1 deletion services/libs/tinybird/datasources/mentions.datasource
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ SCHEMA >
`projectSlug` LowCardinality(String) `json:$.projectSlug` DEFAULT '',
`createdAt` DateTime64(3) `json:$.createdAt` DEFAULT now64(3),
`bookmarked` UInt8 `json:$.bookmarked`,
`keywords` Array(String) `json:$.keywords[:]`
`keywords` Array(String) `json:$.keywords[:]`,
`authorFollowerCount` Nullable(Int32) `json:$.authorFollowerCount`,
`tags` Array(Nullable(String)) `json:$.tags[:]`

ENGINE ReplacingMergeTree
ENGINE_PARTITION_KEY toYear(timestamp)
Expand Down
6 changes: 5 additions & 1 deletion services/libs/tinybird/pipes/octolens_mentions_sink.pipe
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
DESCRIPTION >
Sink pipe to export Octolens mentions data to Kafka for Snowflake ingestion.
Reads from mentions datasource using FINAL to get deduplicated data.
Runs daily at 00:30 UTC, exporting all data (full snapshot).
Runs daily at 00:30 UTC, exporting only data created since the last run.
Uses createdAt filter to get rows added the previous day (incremental sync).

NODE octolens_mentions_select_fields
SQL >
Expand All @@ -28,8 +29,11 @@ SQL >
createdAt,
bookmarked,
arrayStringConcat(keywords, ',') as keywords,
authorFollowerCount,
arrayStringConcat(tags, ',') as tags,
toStartOfDay(now()) as date
FROM mentions FINAL
WHERE createdAt >= toStartOfDay(now()) - INTERVAL 1 DAY AND createdAt < toStartOfDay(now())

TYPE SINK
EXPORT_SERVICE kafka
Expand Down