Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

save data to .csv

 
hello,

in fabric dataflow, after some transformations, I have got the data.

Now I would like to save this data as csv.

How do I do this in notebook? 

thanks

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi again Anonymous 
    Thanks for using Fabric Community.
    Unfortunately, Fabric Dataflow (Gen2) itself doesn't have a built-in functionality to directly save the transformed data as an CSV file. However, you can achieve this by integrating Dataflow with Notebooks:

    1) Give the destination as lakehouse in Dataflow Gen2 and publish the Dataflow . This will create a new table in your lakehouse.

     

     

     


    2) Create a new notebook and run the below code:

     

    df = spark.sql("SELECT * FROM lakehouse_1.customers_1000 ")
    df.write.option("header",True).csv("Files/customersnew.csv")
     
    3) A file will be created in the lakehouse files section:


    Hope this helps. Please let me know if you have any further questions.

6 Replies

Replies have been turned off for this discussion
  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi again Anonymous 
    Thanks for using Fabric Community.
    Unfortunately, Fabric Dataflow (Gen2) itself doesn't have a built-in functionality to directly save the transformed data as an CSV file. However, you can achieve this by integrating Dataflow with Notebooks:

    1) Give the destination as lakehouse in Dataflow Gen2 and publish the Dataflow . This will create a new table in your lakehouse.

     

     

     


    2) Create a new notebook and run the below code:

     

    df = spark.sql("SELECT * FROM lakehouse_1.customers_1000 ")
    df.write.option("header",True).csv("Files/customersnew.csv")
     
    3) A file will be created in the lakehouse files section:


    Hope this helps. Please let me know if you have any further questions.

  • Adding on top of what Anonymous stated, you can even use data pipelines to copy the data from lakehouse and save this data as csv in the sink supported by data pipeline if need be.

    Any specific reason why you want to integrate notebook?

    • Anonymous's avatar
      Anonymous
      Not applicable

      please do let me know how to save the data as .csv in the pipeline

      thank you

      • NandanHegde's avatar
        NandanHegde
        Super User

        you can use Copy activity for the same post dataflow trigger

        where destination can be any sink supported by data pipelines.
        In my example I have taken lakehouse only