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

Add support for message-level extra_fields #14

Merged
merged 7 commits into from
Apr 13, 2021

Conversation

chuhlomin
Copy link
Contributor

@chuhlomin chuhlomin commented Nov 4, 2019

This PR adds support for "extra_fields" message-level custom option that allows defining artificial fields that has to be added to BigQuery schema (but not to be exposed to other schema-users).

For example:

message Bar {
  option (gen_bq_schema.bigquery_opts).table_name = "bar_table";
  option (gen_bq_schema.bigquery_opts).extra_fields = "i2:INTEGER";
  option (gen_bq_schema.bigquery_opts).extra_fields = "i3:TIMESTAMP";

  string i1 = 1;
}

will result in this BQ schema:

[
  { "name": "i1", "type": "STRING", "mode": "NULLABLE" },
  { "name": "i2", "type": "INTEGER", "mode": "NULLABLE" },
  { "name": "i3", "type": "TIMESTAMP", "mode": "NULLABLE" },
]

(see more examples in plugin_test.go)

@sdotz
Copy link

sdotz commented Dec 5, 2019

Using this right now Konstantin

@shreelekha
Copy link

shreelekha commented Apr 8, 2021

@chuhlomin @mescanne Hello! we use this message level extra_fields. Is it possible to get these changes merged?

@sbower
Copy link

sbower commented Apr 13, 2021

@mescanne This would be super helpful, would be great to get it merged

@mescanne mescanne mentioned this pull request Apr 13, 2021
Fixed formatting and typo.
Fixed formatting of generated code.
@mescanne mescanne merged commit d2bd330 into GoogleCloudPlatform:master Apr 13, 2021
@mescanne
Copy link
Collaborator

This is now merged. Are you using the latest master or a release? I'm going to assume master branch in which case it should be there now.

@chuhlomin chuhlomin deleted the extra_fields branch April 13, 2021 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants