Skip to content

Commit 8397e67

Browse files
Andres Garciaandresgarciaf
authored andcommitted
Adjusted few lines to comply with feedback. And handling id correctly.
1 parent 21ecb4c commit 8397e67

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/databricks/labs/ucx/installer/workflows.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,19 @@ def _prepare_directories() -> None:
191191
os.makedirs(UCX_PATH / "tmp/", exist_ok=True)
192192
os.makedirs(DOWNLOAD_PATH, exist_ok=True)
193193
194+
def _process_id_columns(df):
195+
id_columns = [col for col in df.columns if 'id' in col.lower()]
196+
197+
if id_columns:
198+
for col in id_columns:
199+
df[col] = "'" + df[col].astype(str)
200+
return df
194201
195202
def _to_excel(dataset: Dataset, writer: ...) -> None:
196203
'''Execute a SQL query and write the result to an Excel sheet.'''
197204
worksheet_name = dataset.display_name[:31]
198205
df = spark.sql(dataset.query).toPandas()
206+
df = _process_id_columns(df)
199207
with lock:
200208
df.to_excel(writer, sheet_name=worksheet_name, index=False)
201209

0 commit comments

Comments
 (0)