Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added enumsasints plugin parameter #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chuhlomin
Copy link
Contributor

@chuhlomin chuhlomin commented Dec 8, 2019

This PR is introducing enumsasints plugin parameter to change the behavior of the plugin and use Integers instead of Strings in BigQuery schema to express Protobuf Enums values.

Potentially solves #3

Example usage:

protoc --bq-schema_out=enumsasints=true:bq_schema foo.proto

Implemented and tested in https://github.com/chuhlomin/protoc-gen-bq-schema:

@jeremiepiotte-districtm
Copy link

Can this PR be merged? It would be of great help without modifying the source code too much.

Thank you

@chuhlomin
Copy link
Contributor Author

@ashutosh25apr
Copy link

Facing issue with generated schema for map , which the bigquery considers as a repeated record with field names as key and value ,but json generated from proto pojo doesn't contain key and value in it

@chuhlomin
Copy link
Contributor Author

Facing issue with generated schema for map

Hey, I cannot reproduce that issue, could you provide some examples?

Here is what I tried: foo.proto

map<string, string> someMap = 9;

bar_table.schema:

 {
  "name": "someMap",
  "type": "RECORD",
  "mode": "REPEATED",
  "fields": [
   {
    "name": "key",
    "type": "STRING",
    "mode": "NULLABLE"
   },
   {
    "name": "value",
    "type": "STRING",
    "mode": "NULLABLE"
   }
  ]
 },

@judahrand
Copy link

@mescanne Is this an approach you'd be happy with or would you prefer a field by field option in the Protobuf definitions?

@mescanne
Copy link
Collaborator

@mescanne Is this an approach you'd be happy with or would you prefer a field by field option in the Protobuf definitions?

As long as it's backwards compatible (ie behind a flag) and is a step forward in terms of improvement I'm happy.

I'd also like to have a test case for it -- the CI re-generates the examples and ensure they match up with what's in git, so we can run the re-generation twice (once with the flag, once without) into two separate outputs and ensure things match up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants