问题
Very similar to this post, Have set up a connector, but the getData() function, which is using a SQL query does not seem to be pulling any data through.
Have also used this colabs for guidance.
As far as I can see from the logs, I'm authenticating to my db fine, but it doesn't seem to be pulling anything.
this question showed an output, but I'm developing in https://script.google.com/ and I can't see how to get a readout of the query as they have done.
Update
added "useQueryConfig": true
into "appsscript.json" and now getting a new error
end update
this is the error I'm getting in DS
This is the bits of my code where I think I must be missing something.
function getFields() {
var fields = cc.getFields();
var types = cc.FieldType;
//21 VIN Text None
fields
.newDimension()
.setId('customer_id')
.setName('customer_id')
.setType(types.TEXT);
return fields;
}
function getSchema(request) {
schema = {schema: getFields().build()}
return schema;
}
var BASE_SQL = 'SELECT distinct customer_id from `generic_project.boring_dataset.customer_table`';
function getData(request) {
var accessToken = getOauthService().getAccessToken();
var serviceAccountCreds = getServiceAccountCreds();
var billingProjectId = serviceAccountCreds[BILLING_PROJECT_ID];
var bqTypes = DataStudioApp.createCommunityConnector().BigQueryParameterType;
cc
.newBigQueryConfig()
.setAccessToken(accessToken)
.setBillingProjectId(billingProjectId)
.setUseStandardSql(true)
.setQuery(BASE_SQL)
.build();
return cc;
}
This is the admin function:
// function to allow admin
function isAdminUser() {
return true;
}
来源:https://stackoverflow.com/questions/62384253/data-studio-community-connector-for-bigquery