https://delta.io logo
a

Alfonso

06/29/2023, 10:36 AM
Hi all, a quick question, it there a way to add a new column with a default value? in this case is boolean column and i want to set all previous records to false
j

JosephK (exDatabricks)

06/29/2023, 11:32 AM
Copy code
df.select("*", lit(False).alias("colname"))
appends a new column of Booleans
a

Alfonso

06/29/2023, 12:06 PM
i was expecting a way to do an alter table, not overwriting the whole table
j

JosephK (exDatabricks)

06/29/2023, 12:28 PM
alter table changes metadata, adding a new column of values isn't metadata
a

Alfonso

06/29/2023, 12:36 PM
some kind of metadata to fill the column with a default value but i see that is not the case