要在BigQuery中分析GitHub回购同比增长,首先需要获取GitHub的相关数据。这通常涉及到从GitHub API或其他数据源提取数据,并将其存储在BigQuery中。以下是一个简化的步骤指南:
github_repurchases
,包含字段repurchase_date
、shares
和price
):WITH yearly_data AS (
SELECT
EXTRACT(YEAR FROM repurchase_date) AS year,
SUM(shares * price) AS total_repurchase_value
FROM
`your_dataset.github_repurchases`
GROUP BY
year
),
year_over_year_growth AS (
SELECT
y1.year,
(y1.total_reparging_value - IFNULL(y2.total_repurchasing_value, 0)) / IFNULL(y2.total_repurchasing_value, 1) * 100 AS growth_percentage
FROM
yearly_data y1
LEFT JOIN
yearly_data y2
ON
y1.year = y2.year + 1
)
SELECT
*
FROM
year_over_year_growth
ORDER BY
year;
领取专属 10元无门槛券
手把手带您无忧上云