Losing Data Format when saving Delta Table

Anonymous
2022-06-30T14:00:32.65+00:00

When I save a spark dataframe to a delta table in databricks, all my data formats get lost (i.e. it all turns into string).
The command for saving I use is: spark_df.write.format("delta").saveAsTable("database.tabelname")

Is there a way to prevent that?

Azure Databricks
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
{count} votes

1 answer

Sort by: Most helpful
  1. PRADEEPCHEEKATLA 91,496 Reputation points Moderator
    2022-07-01T06:35:58.603+00:00

    Hello @Anonymous ,

    Thanks for the question and using MS Q&A platform.

    As per the repro from our end, we are not loosing any data format or changes in the output.

    Here is the dataframe before writing to delta table:

    216854-image.png

    Here is the dataframe after writing to delta table.

    216828-image.png

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators
    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.