使用 Microsoft Fabric 進行資料轉換與分析
Luis Silva
Solution Architect - Data & AI


publisher 與 genre 的文字值大量重複。
publisher 與 genre 的文字值現在各只出現一次。Games 表以數字鍵取代 publisher 與 genre,可節省空間
OLTP 交易系統
事實表



-- [dim_videogames]: Videogames table
-- [dim_genres]: Genres table
-- [dim_publishers]: Publishers table
SELECT game_id, title, gen.genre, pub.publisher
FROM dim_videogames_norm vidg
JOIN dim_genres gen
ON vidg.genre_id = gen.genre_id
JOIN dim_publishers pub
ON vidg.publisher_id = pub.publisher_id
# [videogamesDF]: Videogames DataFrame
# [genresDF]: Genres DataFrame
# [publishersDF]: Publishers DataFrame
videogames1DF = videogamesDF.join(genresDF, ["genre_id"])
videogamesdenormDF = videogames1DF.join(publishersDF, ["publisher_id"])
videogamesdenormDF.select("game_id", "title", "genre_id", "publisher_id").show()

使用 Microsoft Fabric 進行資料轉換與分析