-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from TeoMeWhy/feat/silver
Feat/silver
- Loading branch information
Showing
6 changed files
with
117 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
SELECT | ||
idCustomer AS idCliente, | ||
PointsCustomer AS nrPontosCliente, | ||
flEmail AS flEmailCliente | ||
|
||
FROM bronze.upsell.customers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Databricks notebook source | ||
def import_query(path): | ||
with open(path, "r") as open_file: | ||
return open_file.read() | ||
|
||
tablename = dbutils.widgets.get("tablename") | ||
|
||
query = import_query(f"{tablename}.sql") | ||
|
||
(spark.sql(query) | ||
.write | ||
.format("delta") | ||
.mode("overwrite") | ||
.option("overwriteSchema", "true") | ||
.saveAsTable(f"silver.upsell.{tablename}")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
SELECT DISTINCT NameProduct | ||
FROM bronze.upsell.transactions_product | ||
ORDER BY 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
SELECT | ||
idTransactionCart AS idTransacaoProduto, | ||
idTransaction AS idTransacao, | ||
NameProduct AS descNomeProduto, | ||
QuantityProduct AS nrQuantidadeProduto | ||
|
||
FROM bronze.upsell.transactions_product |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
SELECT idTransaction AS idTransacao, | ||
idCustomer AS idCliente, | ||
dtTransaction AS dtTransacao, | ||
pointsTransaction AS nrPontosTransacao | ||
|
||
FROM bronze.upsell.transactions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters