Google Data Studio custom fields in schema object

426 Views Asked by At

I'm trying to keep up to date with changes in Data Studio Connectors development. A few months ago, they've announced the Data Studio Apps Script Service, and recommended to use the new DataStudioApp class in order to create config and schema objects. Actually, I'm obtaining not only "data" from my servers, but also config and schema objects, because we use the same connector to access different databases according to the user identification. So, my approach is to keep obtaining the json objects from my servers and then parse them to create config and schema objects via DataStudioApp.createCommunityConnector(). My problem is that I've put a "custom field" in schema metric object and have no method to declare it in DataStudioApp class.

this is one of my schema metric object:

[...]
  {
    "name" : "cantid",
    "label" : "Cantidad",
    "dataType" : "NUMBER",
    "isDefault " : true, 
    "semantics" : {
      "conceptType" : "METRIC",
      "semanticGroup" : "NUMERIC",
      "isReaggregatable" : true
    },
    "sqlname" :  "sum(cantid) as cantid"
  },
[...]

sqlname is my custom field.

Is there a way to declare this?.

1

There are 1 best solutions below

0
Justin On

Not sure if you solved this already, but ran into the almost same situation. The solution for me was to write a function that will look at my schema later using the field name as the reference point for the lookup in my JSON schema. This allowed me to use custom fields as needed, but not have to rely on google data studio supporting them.

Know its quite awhile later, but hope it helps you or someone else!