Skip to content

Commit

Permalink
Merge pull request #49 from TeoMeWhy/feat/ibge
Browse files Browse the repository at this point in the history
Feat/ibge
  • Loading branch information
TeoCalvo authored Aug 9, 2023
2 parents ac78baf + bfc5f81 commit 42347c9
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 12 deletions.
30 changes: 18 additions & 12 deletions databases/create.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
-- Databricks notebook source
-- DBTITLE 1,Olist
CREATE DATABASE IF NOT EXISTS bronze.olist;
CREATE DATABASE IF NOT EXISTS silver.olist;
-- DBTITLE 1,DataSUS
CREATE DATABASE IF NOT EXISTS bronze.datasus;
CREATE DATABASE IF NOT EXISTS silver.datasus;

-- COMMAND ----------

-- DBTITLE 1,Dota
CREATE DATABASE IF NOT EXISTS bronze.dota;
CREATE DATABASE IF NOT EXISTS silver.dota;

-- COMMAND ----------

-- DBTITLE 1,IBGE
CREATE DATABASE IF NOT EXISTS bronze.ibge;
CREATE DATABASE IF NOT EXISTS silver.ibge;

-- COMMAND ----------

Expand All @@ -17,12 +29,6 @@ CREATE DATABASE IF NOT EXISTS silver.pizza_query;

-- COMMAND ----------

-- DBTITLE 1,DataSUS
CREATE DATABASE IF NOT EXISTS bronze.datasus;
CREATE DATABASE IF NOT EXISTS silver.datasus;

-- COMMAND ----------

-- DBTITLE 1,Dota
CREATE DATABASE IF NOT EXISTS bronze.dota;
CREATE DATABASE IF NOT EXISTS silver.dota;
-- DBTITLE 1,Olist
CREATE DATABASE IF NOT EXISTS bronze.olist;
CREATE DATABASE IF NOT EXISTS silver.olist;
10 changes: 10 additions & 0 deletions src/02.bronze/ibge/ingestao_municipios.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Databricks notebook source
path = "/mnt/datalake/ibge/municipios_brasileiros.csv"

df = (spark.read
.csv(path, header=True, sep=";"))

(df.write
.format("delta")
.mode("overwrite")
.saveAsTable("bronze.ibge.municipios_brasileiros"))
9 changes: 9 additions & 0 deletions src/03.silver/ibge/municipios_brasileiros.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- Databricks notebook source
DROP TABLE IF EXISTS silver.ibge.municipios_brasileiros;

CREATE TABLE IF NOT EXISTS silver.ibge.municipios_brasileiros AS (

SELECT *
FROM bronze.ibge.municipios_brasileiros

);

0 comments on commit 42347c9

Please sign in to comment.