Google BigQuery - Streaming von Daten in BigQueryJava

Java-Forum
Anonymous
 Google BigQuery - Streaming von Daten in BigQuery

Post by Anonymous »

Ich benutze Google BigQuery für mein Projekt
Im Moment versuche ich, eine neue Zeile in BQ zu fügen, basierend auf diesem https://cloud.google.com/bigquery/strea ... -data-java

Code: Select all

private void insertRowsToBQ(MyCustomObject data) {
String datasetName = "mydatasetname";
String tableName = "mytablename";
Map rowContent = new HashMap();
rowContent.put("field_1", data.getdata1());
rowContent.put("field_2", data.getdata2());
rowContent.put("field_3", data.getdata3());
rowContent.put("field_4", data.getdata4());

try {
BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService();
TableId tableId = TableId.of(datasetName, tableName);
InsertAllResponse response =
bigquery.insertAll(
InsertAllRequest.newBuilder(tableId)
.addRow(rowContent)
.build());

if (response.hasErrors()) {
for (Map.Entry entry : response.getInsertErrors().entrySet()) {
Logger.error("Response error: \n" + entry.getValue());
}
}
Logger.info("Rows successfully inserted into table");
} catch (BigQueryException e) {
Logger.error("Insert operation not performed \n" + e.toString());
}
}
Der Code funktioniert gut, hat kein Fehlerprotokoll
, aber wenn ich versuche, ihn auf Google Console zu sehen
https://console.cloud.google.com/bigQue ... rojectName
select * from `myprojectname.mydatasetname.mytablename` where DATE(_PARTITIONTIME) = "2021-03-24"
< /code>
Die Daten auf der Google BQ -Konsole werden nicht angezeigt. Oder es gibt Probleme?>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post