google cloud storage - Cannot write date in BigQuery using Java Bigquery Client API -


i'm doing etl csv file in gcs bq, works fine, except dates. field name in table test_time , type date, in tablerow tried passing java.util.date, com.google.api.client.util.datetime, string, long value number of seconds, none worked.
got error messages these: not convert non-string json value date type. field: test_time; value: ...
when using datetime got error: json object specified non-record field: test_time.

//tablerow.set("test_time", date); //tablerow.set("test_time", new datetime(date)); //tablerow.set("test_time", date.gettime()/1000); //tablerow.set("test_time", dateformatter.format(date)); //e.g. 05/06/2016 

i think you're expected pass string in format yyyy-mm-dd, similar if using rest api directly json. try this:

tablerow.set("test_time", "2017-04-06"); 

if works, can convert actual date have format , should work.


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -