Home > Software design >  Creating a Protobuf file from CSV
Creating a Protobuf file from CSV

Time:11-30

Good day everyone. I need to create a simple file in Protobuf (proto) format, preferably using Python (I'm currently using PyCharm). It should be very simple and resemble the following CSV structure:

header = ['Surname', 'Name'] data = ['John', 'Doe']

If anyone knows how to do it, it would help me a lot. Thanks!

I have already transformed this CSV structure into a Parquet file and tried doing the same for Protobuf, but it didn't work.

CodePudding user response:

What issues have you faced?

syntax="proto3";

message Data {
  string surname = 1;
  string name = 2;
}

message CSV {
  repeated Data data = 1;
}

or

syntax="proto3";

message Data {
  string data1 = 1;
  string data2 = 2;
}

message CSV {
  string header1 = 1;
  string header2 = 2;
  repeated Data data = 3;
}
  • Related