How to run ScalaPB on Databricks / Spark ?

Skip to first unread message

Amir Ketata

Dec 27, 2019, 2:59:20 PM12/27/19
to ScalaPB

I'm more of a data engineer not a stack developer. I would like to convert Protobuf stream and files using Databricks. I read that I can achieve reading Protobuf and converting them into JSON using ScalaPB. But how do I achieve that running ScalaPB on Databricks ?

FYI: Here is how to import libraries in databricks:

Thank you very much in advanced!

Nadav Samet

Dec 27, 2019, 3:21:55 PM12/27/19
to Amir Ketata, ScalaPB
Hi Amir,

The easiest way would be to build a single "fat jar" that contains everything that you need using SBT and load it into databricks. 
Assuming you have SBT installed locally, roughly the steps are

1. Create an sbt project with ScalaPB using:
sbt new scalapb/scalapb-template.g8

2. Add your protobufs into src/main/protobuf

3. Add scalpb-json4s to the project as a library dependency.

4. Add sbt-assembly to your project. See steps here
You may also need to shade Jackson in case you are getting some MethodNotFound errors.

5. Run "sbt assembly" to generate the fat jar.

6. Upload the generated JAR into databricks.

7. Try loading your protos using the generated code. Docs of JSON api here:

Hope it helps,

You received this message because you are subscribed to the Google Groups "ScalaPB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Reply all
Reply to author
0 new messages