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

blink_features.usage with ranks and partitioned #39

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

Conversation

max-ostapenko
Copy link
Contributor

@max-ostapenko max-ostapenko commented Dec 21, 2024

  1. Added rank column.
    Resolves blink_features.usage has null rank column #25

  2. Removed the blink_features.features table, as it's a duplicate of a pages.features column.
    And now loading usage data directly to blink_features.usage partitioned table.

Table migration script:

CREATE TABLE `blink_features.usage_partitioned` (
  date DATE,
  client STRING,
  rank INT64,
  id STRING,
  feature STRING,
  type STRING,
  num_urls INT64,
  total_urls INT64,
  pct_urls FLOAT64,
  sample_urls ARRAY<STRING>
)
PARTITION BY date
CLUSTER BY client, rank, feature
OPTIONS (
  require_partition_filter = TRUE
);

INSERT INTO `blink_features.usage_partitioned`
SELECT
  PARSE_DATE('%Y%m%d', yyyymmdd) AS date,
  client,
  NULL AS rank,
  id,
  feature,
  type,
  num_urls,
  total_urls,
  pct_urls,
  sample_urls
FROM `blink_features.usage`;

ALTER TABLE `blink_features.usage` RENAME TO `blink_features.usage_backup`;

CREATE TABLE `blink_features.usage`
COPY `blink_features.usage_partitioned`;

@max-ostapenko
Copy link
Contributor Author

@tunetheweb do you have edit access to the Looker report using this data?

@max-ostapenko max-ostapenko marked this pull request as draft December 21, 2024 16:42
@max-ostapenko max-ostapenko marked this pull request as ready for review December 21, 2024 17:05
@max-ostapenko max-ostapenko changed the title blink_features.usage partitioned blink_features.usage with ranks and partitioned Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

blink_features.usage has null rank column
1 participant