Skip to content
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

WIP: Adding post type column #21485

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

WIP: Adding post type column #21485

wants to merge 1 commit into from

Conversation

ErisDS
Copy link
Member

@ErisDS ErisDS commented Oct 31, 2024

  • This is genuinely something we need to do :D

Got some code for us? Awesome 🎊!

Please include a description of your change & check your PR against this list, thanks!

  • There's a clear use-case for this code change, explained below
  • Commit message has a short title & references relevant issues
  • The build will pass (run yarn test:all and yarn lint)

We appreciate your contribution!

- This is genuinely something we need to do :D
@ErisDS
Copy link
Member Author

ErisDS commented Oct 31, 2024

root@28eb03bbc090:/ghost/ghost/tinybird# tb diff
** UPDATE AVAILABLE: please run "pip install tinybird-cli==5.10.1" to update or `export TB_VERSION_WARNING=0` to skip the check.
** current: tinybird-cli 5.10.0

Saving remote resources in .diff_tmp folder.

** Writing /ghost/ghost/tinybird/.diff_tmp/analytics_events.datasource
** Writing /ghost/ghost/tinybird/.diff_tmp/analytics_pages_mv.datasource
** Writing /ghost/ghost/tinybird/.diff_tmp/analytics_sessions_mv.datasource
** Writing /ghost/ghost/tinybird/.diff_tmp/analytics_sources_mv.datasource
** Writing /ghost/ghost/tinybird/.diff_tmp/analytics_hits.pipe
** Writing /ghost/ghost/tinybird/.diff_tmp/kpis.pipe
** Writing /ghost/ghost/tinybird/.diff_tmp/analytics_sources.pipe
** Writing /ghost/ghost/tinybird/.diff_tmp/analytics_pages.pipe
** Writing /ghost/ghost/tinybird/.diff_tmp/analytics_sessions.pipe
** Writing /ghost/ghost/tinybird/.diff_tmp/top_sources.pipe
** Writing /ghost/ghost/tinybird/.diff_tmp/top_browsers.pipe
** Writing /ghost/ghost/tinybird/.diff_tmp/top_locations.pipe
** Writing /ghost/ghost/tinybird/.diff_tmp/top_pages.pipe
** Writing /ghost/ghost/tinybird/.diff_tmp/top_devices.pipe
** Writing /ghost/ghost/tinybird/.diff_tmp/trend.pipe
--- analytics_hits.pipe [remote]
+++ ./pipes/analytics_hits.pipe [local]
@@ -23,6 +23,7 @@
         JSONExtractString(payload, 'member_uuid') as member_uuid,
         JSONExtractString(payload, 'member_status') as member_status,
         JSONExtractString(payload, 'post_uuid') as post_uuid,
+        JSONExtractString(payload, 'post_type') as post_type,
         lower(JSONExtractString(payload, 'user-agent')) as user_agent
     FROM analytics_events
     where action = 'page_hit'
@@ -38,6 +39,7 @@
         member_uuid,
         member_status,
         post_uuid,
+        post_type,
         location,
         domainWithoutWWW(referrer) as source,
         pathname,

--- analytics_pages.pipe [remote]
+++ ./pipes/analytics_pages.pipe [local]
@@ -7,6 +7,7 @@
         site_uuid,
         toDate(timestamp) AS date,
         post_uuid,
+        post_type,
         device,
         browser,
         location,
@@ -16,7 +17,7 @@
         uniqState(session_id) AS visits,
         countState() AS pageviews
     FROM analytics_hits
-    GROUP BY date, device, browser, location, source, pathname, post_uuid, site_uuid
+    GROUP BY date, device, browser, location, source, pathname, post_uuid, post_type, site_uuid

 TYPE MATERIALIZED
 DATASOURCE analytics_pages_mv

root@28eb03bbc090:/ghost/ghost/tinybird# tb deploy
** UPDATE AVAILABLE: please run "pip install tinybird-cli==5.10.1" to update or `export TB_VERSION_WARNING=0` to skip the check.
** current: tinybird-cli 5.10.0


** Detecting changes from last commit ...
** Diffs from current commit 'dd2ed27d9d0582a0ccbf10ec12235cd619574c49' and new '77852adccedbc39e28d70496554b2d5a3b070056':
	modified:	ghost/tinybird/pipes/analytics_hits.pipe
	modified:	ghost/tinybird/pipes/analytics_pages.pipe

** Preparing commit ...
** Processing ./pipes/analytics_pages.pipe
** Processing ./pipes/analytics_hits.pipe
** Processing datasources/analytics_events.datasource
** Processing datasources/analytics_pages_mv.datasource
** Building dependencies

** [DRY RUN] Deploying commit ...
** [DRY RUN] Running 'analytics_hits'
** [DRY RUN] Running 'analytics_pages'

** Deploying commit ...
** Running 'analytics_hits'
Error:
** Failed running ./pipes/analytics_hits.pipe:
** Failed pushing pipe analytics_hits: Forbidden: Cannot modify the node endpoint since it's used in Materialized Nodes: analytics_sources.analytics_sources_1,analytics_pages.analytics_pages_1,analytics_sessions.analytics_sessions_1. You can duplicate the Pipe or unlink the related Materialized Nodes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant