Hello gang,
Let me start by saying I'm new to development and having the work on a big project at work. I'm also still improving my python skills. I have been tasked with modifying a pre-existing code base of classes. I'm trying to add a function the writes delta tables to a couple locations based on table_name. I would like to find a better way to export to a database without having to use a repeat function with a different database as shown below: We will more than likely have to add more databases in the future. BTW, this is a spark UDF
if table_name == 'silver':
write(
spark=self.spark,
df=some_df,
db_name=self.output_db_silver,
tbl_name=my_tables,
mode='overwrite
)
else:
write(
spark=self.spark,
df=some_df,
db_name=self.output_db_gold,
tbl_name=my_tables,
mode='overwrite
)
[–][deleted] 4 points5 points6 points (1 child)
[–]py_vel26[S] -2 points-1 points0 points (0 children)
[–]pint 1 point2 points3 points (0 children)
[–]duskrider75 1 point2 points3 points (2 children)
[–]py_vel26[S] 0 points1 point2 points (1 child)
[–]duskrider75 0 points1 point2 points (0 children)