-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 a snippet to show how to read a newline-delimited-json file and store it in a Table #2974
Conversation
…m GCS and store it in a BQ Table.
.build(); | ||
// Table field definition | ||
ArrayList<Field> fields = new ArrayList<>(); | ||
for (String fieldName: fieldNames) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
fields.add(Field.of(fieldName, LegacySQLTypeName.STRING)); | ||
} | ||
// Table schema definition | ||
Schema schema = Schema.of(fields.toArray(new Field[fields.size()])); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Schema schema = Schema.of(fields.toArray(new Field[fields.size()])); | ||
// Create the table | ||
StandardTableDefinition tableDefinition = StandardTableDefinition.of(schema); | ||
bigquery.create(TableInfo.of(tableId, tableDefinition)); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
// [TARGET writer(WriteChannelConfiguration)] | ||
// [VARIABLE "my_dataset_name"] | ||
// [VARIABLE "my_table_name"] | ||
// [VARIABLE "my_source_uri")] |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
// [VARIABLE "my_dataset_name"] | ||
// [VARIABLE "my_table_name"] | ||
// [VARIABLE "my_source_uri")] | ||
// [VARIABLE "field_names")] |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
After talking to Tim, I made some changes. Can you please review the changes? Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sample LGTM, thanks.
Sorry I forgot about this earlier, but there's also a Python script to run which will ensure this sample gets included in the Javadocs for the library. The script is at https://github.com/GoogleCloudPlatform/google-cloud-java/blob/master/utilities/add_snippets_to_file.py |
@@ -524,6 +524,19 @@ public int hashCode() { | |||
* } | |||
* } </pre> | |||
* | |||
* <p>Example of creating a dataset. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
* String query = | ||
* "SELECT distinct(corpus) FROM `bigquery-public-data.samples.shakespeare` where word_count > ?"; | ||
* <pre> {@code | ||
* String query = "SELECT distinct(corpus) FROM `bigquery-public-data.samples.shakespeare` where; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Let's clean up some of the Javadoc strings in BigQuery.java manually and call this one done. I don't know what went wrong with the script.
No description provided.