简体   繁体   中英

setQueryParameters isn't part of `'com.google.cloud', name: 'google-cloud-bigquery', version: '0.4.0'`

I'm not sure which lib to include:

compile 'com.google.apis:google-api-services-bigquery:v2-rev327-1.22.0'

or

compile group: 'com.google.cloud', name: 'google-cloud-bigquery', version: '0.4.0'

I saw this example on how to set a bigQ java client

However I want to inject the params into the bigQ query.

I thought to use this:

    List<QueryParameter> params =  new ArrayList<>();

    QueryParameter param = new QueryParameter();
    param.setName("country");
    param.setParameterValue(new QueryParameterValue().setValue(brandChangeDataUi.country));
    param.setParameterType(new QueryParameterType().setType("string"));
    params.add(param);

    param = new QueryParameter();
    param.setName("countryAbbr");
    param.setParameterValue(new QueryParameterValue().setValue(brandChangeDataUi.countryAbbr));
    param.setParameterType(new QueryParameterType().setType("string"));
    params.add(param);

    param = new QueryParameter();
    param.setName("brand");
    param.setParameterValue(new QueryParameterValue().setValue(brandChangeDataUi.country));
    param.setParameterType(new QueryParameterType().setType("string"));
    params.add(param);



    JobConfigurationQuery jobConfigurationQuery = new JobConfigurationQuery();
    jobConfigurationQuery.setQueryParameters(params);
    jobConfigurationQuery.setUseLegacySql(false);


    jobConfigurationQuery.setQuery( "select id,lng,lat,venue3.brand.value from waze_prod.venues_full.versioned.latest " +
                    "where (country = @country or country = @countryAbbr)";

but I wonder how come there is no official example with setQueryParameters .

It's not part of the lib here compile 'com.google.apis:google-api-services-bigquery:v2-rev327-1.22.0'

Should I use something else?

However I want to inject the parameters

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM