-
Notifications
You must be signed in to change notification settings - Fork 740
feat: add the TInyBird resources for the search volume data #3178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Raúl Santos <4837+borfast@users.noreply.github.com>
Signed-off-by: Raúl Santos <4837+borfast@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added a few nitpicks and some consistency points
@@ -0,0 +1,12 @@ | |||
SCHEMA > | |||
`id` UInt64 `json:$.record.id`, | |||
`projectId` UUID `json:$.record.project_id`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: can we call this insightsProjectId
to be consistent with the rest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, no problem.
NODE searchVolume_pipe | ||
SQL > | ||
% | ||
SELECT projectId, keyword, dataTimestamp, volume, updatedAt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: same naming nitpick as above
|
||
ENGINE ReplacingMergeTree | ||
ENGINE_PARTITION_KEY toYear(dataTimestamp) | ||
ENGINE_SORTING_KEY projectId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can add dataTimestamp
to the sorting key - since queries will filter out first by insightsProjectId and timestamp, I'm guessing it's gonna help with filtering performance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. In fact, the project ID will probably not help much here at all, since we're going to query by keyword (the project slug), not project ID, so I think removing the project ID from here is even better.
SQL > | ||
% | ||
SELECT projectId, keyword, dataTimestamp, volume, updatedAt | ||
FROM searchVolume |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably want FINAL
here since the engine is ReplacingMergeTree
in the source
) | ||
}} | ||
{% end %} | ||
{% if defined(projectId) %} AND searchVolume.projectId = {{ projectId }} {% end %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: It's gonna help with consistency and usability of the pipe if we provide a project slug filter instead of an opaque id filter here. (since everywhere else FE expects this filtering to be done by slug)
There's a reusable example here
Another benefit of using segments_filtered
pipe for this is that it provides insightsProjects.enabled
check as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The keyword
filter below this one is actually the slug. I'll change the name, it doesn't make sense to use the syntax from Keywords Everywhere here.
d7cf633
to
8726d7d
Compare
Signed-off-by: Raúl Santos <4837+borfast@users.noreply.github.com>
8726d7d
to
97d233e
Compare
Signed-off-by: Raúl Santos <4837+borfast@users.noreply.github.com>
Signed-off-by: Raúl Santos <4837+borfast@users.noreply.github.com>
@epipav , can you review this again, please? |
Ticket in Linear
This adds the TinyBird data source and pipe with the respective endpoint for the search volume data, to be consumed by the Insights application.