Skip to content

Commit d7435c2

Browse files
committed
minor fixes
1 parent 7d276b5 commit d7435c2

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

  • containers/airflow/dags/brasil/sinan

containers/airflow/dags/brasil/sinan/dengue.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,12 @@ def to_sql_include_cols(df: pd.DataFrame, prelim: bool, engine):
6565
columns_to_add = df_columns.difference(sql_columns)
6666

6767
if columns_to_add:
68-
sql_statements = [f"ALTER TABLE {tablename}"]
68+
sql_statements = [f"ALTER TABLE brasil.{tablename}"]
6969
for column in columns_to_add:
7070
sql_statements.append(f"ADD COLUMN {column} TEXT,") # object
7171

72+
sql_statements[-1] = sql_statements[-1].replace(',', ';')
73+
7274
with create_engine(egh_conn['URI']).connect() as conn:
7375
sql = ' '.join(sql_statements)
7476
logging.warning(f"EXECUTING: {sql}")
@@ -81,7 +83,7 @@ def to_sql_include_cols(df: pd.DataFrame, prelim: bool, engine):
8183
df[col] = pd.to_datetime(df[col]).dt.strftime('%d%m%Y').astype('object')
8284
dtype = 'object'
8385
logging.warning(
84-
f"Column '{col}' of type '{dtype}' has been parsed to 'object'"
86+
f"Column '{col}' of type 'DATE' has been parsed to 'TEXT'"
8587
)
8688
except ValueError as error:
8789
logging.error(f'Could not format date column correctly: {error}')

0 commit comments

Comments
 (0)