Skip to content

Commit

Permalink
Merge pull request #57 from TeoMeWhy/feat/dota
Browse files Browse the repository at this point in the history
Feat/dota
  • Loading branch information
TeoCalvo authored Aug 16, 2023
2 parents 2ac9217 + 509630c commit 8085f61
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 0 deletions.
76 changes: 76 additions & 0 deletions src/03.silver/dota/etl/matches_players.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
SELECT

match_id AS idMatch,
from_unixtime(start_time) AS dtMatch,
duration AS nrDuration,
patch AS nrPatch,
radiant_win AS flRadiantWin,
account_id AS idPlayer,
personaname AS descPersonname,
name AS descName,
isRadiant AS flIsRadiant,
win AS flWin,
lose AS flLose,
backpack_0 AS idItemBackpack01,
backpack_1 AS idItemBackpack02,
backpack_2 AS idItemBackpack03,
backpack_3 AS idItemBackpack04,
camps_stacked AS nrCampsStacked,
creeps_stacked AS nrCreepsStacked,
kills AS nrKills,
assists AS nrAssist,
deaths AS nrDeaths,
denies AS nrDenies,
firstblood_claimed AS flFirstbloodClaimed,
gold AS nrGold,
gold_per_min AS nrGoldMinute,
gold_spent AS nrGoldSpent,
hero_damage AS nrHeroDamage,
hero_healing AS nrHeroHealing,
hero_id AS idHero,
item_0 AS idItem1,
item_1 AS idItem2,
item_2 AS idItem3,
item_3 AS idItem4,
item_4 AS idItem5,
item_5 AS idItem6,
item_neutral AS idNeutralItem,
last_hits AS nrLastHits,
level AS nrLevel,
net_worth AS nrNetWorth,
roshans_killed AS nrRoshansKilled,
rune_pickups AS nrRunePicks,
stuns AS nrStunsSec,
teamfight_participation AS pctTeamfightParticipation,
tower_damage AS nrTowerDamage,
towers_killed AS nrTowerKilled,
xp_per_min AS nrXpMinute,
region AS idRegion,
total_gold AS nrTotalGold,
total_xp AS nrTotalXp,
kills_per_min AS nrKillsMinute,
kda AS nrKDA,
abandons AS nrAbandons,
neutral_kills AS nrNeutralKills,
tower_kills AS nrTowerKills,
courier_kills AS nrCourierKills,
lane_kills AS nrLaneKills,
hero_kills AS nrHeroKills,
observer_kills AS nrObserverKills,
sentry_kills AS nrSentryKills,
roshan_kills AS nrRoshansKills,
necronomicon_kills AS nrNecronomiconKills ,
ancient_kills AS nrAncientKills,
buyback_count AS nrBuybackCount,
observer_uses AS nrObserverUses,
sentry_uses AS nrSentryUses,
lane_efficiency AS pctLaneEfficiency,
lane AS idLane,
lane_role AS idLaneRole,
purchase_tpscroll AS nrPurchaseTps,
actions_per_min AS nrActionsMinute,
rank_tier AS nrRankTier

FROM bronze.dota.matches_players

WHERE account_id IS NOT NULL
27 changes: 27 additions & 0 deletions src/03.silver/dota/ingestao.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Databricks notebook source
# DBTITLE 1,Imports
import sys

sys.path.insert(0, '../../lib')

import dbtools

# COMMAND ----------

# DBTITLE 1,Setup
table = dbutils.widgets.get("table")

database = 'silver.dota'
table_full_name = f'{database}.{table}'

# COMMAND ----------

# DBTITLE 1,Execução
query = dbtools.import_query(f'etl/{table}.sql')

(spark.sql(query)
.write
.format('delta')
.mode('overwrite')
.option('overwriteSchema', 'true')
.saveAsTable(table_full_name))
18 changes: 18 additions & 0 deletions src/06.workflows/data4u_dota.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,24 @@
"existing_cluster_id": "0523-124114-7ef5b8u0",
"timeout_seconds": 0,
"email_notifications": {}
},
{
"task_key": "silver_matches_players",
"depends_on": [
{
"task_key": "bronze_matches_players"
}
],
"notebook_task": {
"notebook_path": "src/03.silver/dota/ingestao",
"base_parameters": {
"table": "matches_players"
},
"source": "GIT"
},
"existing_cluster_id": "0523-124114-7ef5b8u0",
"timeout_seconds": 0,
"email_notifications": {}
}
],
"git_source": {
Expand Down

0 comments on commit 8085f61

Please sign in to comment.