Skip to content

Commit

Permalink
padronizar nomenclatura dos argumentos
Browse files Browse the repository at this point in the history
  • Loading branch information
pixuimpou committed Oct 16, 2023
1 parent b084387 commit 032763c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pipelines/rj_smtr/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,14 +615,14 @@ def get_raw_data_gcs(


def get_raw_data_db(
sql: str, dbms: str, host: str, secret_path: str, database: str
query: str, engine: str, host: str, secret_path: str, database: str
) -> tuple[str, str, str]:
"""
Get data from Databases
Args:
sql (str): the SQL Query to execute
dbms (str): The datase management system
query (str): the SQL Query to execute
engine (str): The datase management system
host (str): The database host
secret_path (str): Secret path to get credentials
database (str): The database to connect
Expand Down Expand Up @@ -650,16 +650,16 @@ def get_raw_data_db(
try:
credentials = get_vault_secret(secret_path)["data"]

connection = connection_mapping[dbms](
connection = connection_mapping[engine](
host=host,
user=credentials["user"],
password=credentials["password"],
database=database,
)

with connection:
with connection.cursor(**connection_mapping[dbms]["cursor"]) as cursor:
cursor.execute(sql)
with connection.cursor(**connection_mapping[engine]["cursor"]) as cursor:
cursor.execute(query)
data = cursor.fetchall()

data = [dict(d) for d in data]
Expand Down

0 comments on commit 032763c

Please sign in to comment.