Skip to content

Commit 9595dab

Browse files
docs(tutorials): Add STRUCT column to tutorial (#1534)
* docs(tutorials): Add STRUCT column to tutorial Add a STRUCT column to the JsonWriteDefaultStream tutorial * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Mike Wasson <3992422+MikeWasson@users.noreply.github.com> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 43446b2 commit 9595dab

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

tutorials/JsonWriterDefaultStream/src/main/java/com/example/JsonWriterDefaultStream.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.google.cloud.bigquery.BigQuery;
2121
import com.google.cloud.bigquery.BigQueryOptions;
2222
import com.google.cloud.bigquery.Field;
23+
import com.google.cloud.bigquery.FieldList;
2324
import com.google.cloud.bigquery.Schema;
2425
import com.google.cloud.bigquery.StandardSQLTypeName;
2526
import com.google.cloud.bigquery.StandardTableDefinition;
@@ -68,8 +69,12 @@ public static void createDestinationTable(
6869
Field.of("author", StandardSQLTypeName.STRING),
6970
Field.of("committer", StandardSQLTypeName.STRING),
7071
Field.of("commit_date", StandardSQLTypeName.DATETIME),
71-
Field.of("subject", StandardSQLTypeName.STRING),
72-
Field.of("message", StandardSQLTypeName.STRING),
72+
Field.of(
73+
"commit_msg",
74+
StandardSQLTypeName.STRUCT,
75+
FieldList.of(
76+
Field.of("subject", StandardSQLTypeName.STRING),
77+
Field.of("message", StandardSQLTypeName.STRING))),
7378
Field.of("repo_name", StandardSQLTypeName.STRING));
7479

7580
// Create a table that uses this schema.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{"commit":"0001","parent":["00001"],"author":"user1","committer":"GitHub","subject":"Commit 1","message":"This is a commit.\n\n","repo_name":"googleapis/java-bigquerystorage","commit_date":"2019-07-23T20:28:01"}
2-
{"commit":"0002","parent":["00002"],"author":"user1","committer":"GitHub","subject":"Commit 2","message":"This is a commit.\n\n","repo_name":"googleapis/java-bigquerystorage","commit_date":"2019-12-05T16:05:16"}
3-
{"commit":"0003","parent":["00003"],"author":"user1","committer":"GitHub","subject":"Commit 3","message":"This is a commit.\n\n","repo_name":"googleapis/java-bigquerystorage","commit_date":"2019-03-21T16:59:23"}
4-
{"commit":"0004","parent":["00004"],"author":"user1","committer":"GitHub","subject":"Commit 4","message":"This is a commit.\n\n","repo_name":"googleapis/java-bigquerystorage","commit_date":"2019-01-11T01:31:39"}
5-
{"commit":"0005","parent":["00005"],"author":"user1","committer":"GitHub","subject":"Commit 5","message":"This is a commit.\n\n","repo_name":"googleapis/java-bigquerystorage","commit_date":"2019-07-31T19:09:09"}
1+
{"commit":"0001","parent":["00001"],"author":"user1","committer":"GitHub","commit_msg":{"subject":"Commit 1","message":"This is a commit.\n\n"},"repo_name":"googleapis/java-bigquerystorage","commit_date":"2019-07-23T20:28:01"}
2+
{"commit":"0002","parent":["00002"],"author":"user1","committer":"GitHub","commit_msg":{"subject":"Commit 2","message":"This is a commit.\n\n"},"repo_name":"googleapis/java-bigquerystorage","commit_date":"2019-12-05T16:05:16"}
3+
{"commit":"0003","parent":["00003"],"author":"user1","committer":"GitHub","commit_msg":{"subject":"Commit 3","message":"This is a commit.\n\n"},"repo_name":"googleapis/java-bigquerystorage","commit_date":"2019-03-21T16:59:23"}
4+
{"commit":"0004","parent":["00004"],"author":"user1","committer":"GitHub","commit_msg":{"subject":"Commit 4","message":"This is a commit.\n\n"},"repo_name":"googleapis/java-bigquerystorage","commit_date":"2019-01-11T01:31:39"}
5+
{"commit":"0005","parent":["00005"],"author":"user1","committer":"GitHub","commit_msg":{"subject":"Commit 5","message":"This is a commit.\n\n"},"repo_name":"googleapis/java-bigquerystorage","commit_date":"2019-07-31T19:09:09"}

0 commit comments

Comments
 (0)