-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
TeoCalvo
authored and
TeoCalvo
committed
Jan 11, 2024
1 parent
ea02023
commit d6e569a
Showing
3 changed files
with
59 additions
and
1 deletion.
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
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,49 @@ | ||
# Databricks notebook source | ||
import sys | ||
|
||
sys.path.insert(0, '../../lib/') | ||
|
||
from ingestors import IngestaoBronze | ||
import dbtools | ||
|
||
# COMMAND ---------- | ||
|
||
database_name = 'bronze.gamersclub' | ||
table_name = dbutils.widgets.get('table_name') | ||
file_format = 'csv' | ||
id_fields = [] | ||
timestamp_field = '' | ||
partition_fields = [] | ||
|
||
path_full_load = f"/mnt/datalake/gc/{table_name}.csv" | ||
path_incremental = '' | ||
|
||
read_options = { | ||
"header": "true", | ||
"multiLine": "true", | ||
"sep": ",", | ||
} | ||
|
||
# COMMAND ---------- | ||
|
||
|
||
ingest = IngestaoBronze( | ||
path_full_load = path_full_load, | ||
path_incremental = path_incremental, | ||
file_format = file_format, | ||
table_name = table_name, | ||
database_name = database_name, | ||
id_fields = id_fields, | ||
timestamp_field = timestamp_field, | ||
partition_fields = partition_fields, | ||
read_options=read_options, | ||
spark = spark, | ||
) | ||
|
||
# COMMAND ---------- | ||
|
||
if not dbtools.table_exists(spark, database_name, table_name): | ||
print("Tabela não existente, realizando primeira carga...") | ||
ingest.process_full() | ||
print("Ok") | ||
|
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