'Pyspark: How do I covert dataframe column values into a comma separated string?

I am running this on Databricks. My goal is to make a select statement with all the values in the column comma separated.

Content of my df:

enter image description here

For example, I want to see SELECT business_key,brand_key,brand_id,... etc.

Thanks in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source