Un DataSourceSpec utilizzato per accedere in modo specifico alle specifiche delle origini dati di Looker esistenti. Per creare una nuova specifica dell'origine dati, utilizza SpreadsheetApp.newDataSourceSpec().
Questo esempio mostra come ottenere la specifica dell'origine dati di Looker da un foglio che ha una sola connessione Looker.
// TODO(developer): Replace the URL with your own. const ss = SpreadsheetApp.openByUrl( 'https://docs.google.com/spreadsheets/d/abc123456/edit', ); const lookerDataSourceSpec = ss.getDataSources()[0].getSpec().asLooker();
Metodi
| Metodo | Tipo restituito | Breve descrizione |
|---|---|---|
copy() | Data | Crea un Data in base alle impostazioni di questa origine dati. |
get | String | Ottiene il nome dell'esplorazione di Looker nel modello. |
get | String | Ottiene l'URL dell'istanza di Looker. |
get | String | Ottiene il nome del modello di Looker nell'istanza. |
get | Data | Ottiene i parametri dell'origine dati. |
get | Data | Ottiene il tipo di origine dati. |
Documentazione dettagliata
copy()
Crea un DataSourceSpecBuilder in base alle impostazioni di questa origine dati.
// TODO(developer): Replace the URL with your own. const ss = SpreadsheetApp.openByUrl( 'https://docs.google.com/spreadsheets/d/abc123456/edit', ); const spec = ss.getDataSources()[0].getSpec(); const newSpec = spec.copy();
Indietro
DataSourceSpecBuilder : il builder.
getExploreName()
Ottiene il nome dell'esplorazione di Looker nel modello.
// TODO(developer): Replace the URL with your own. const ss = SpreadsheetApp.openByUrl( 'https://docs.google.com/spreadsheets/d/abc123456/edit', ); const lookerDataSourceSpec = ss.getDataSources()[0].getSpec().asLooker(); const exploreName = lookerDataSourceSpec.getExploreName(); Logger.log(exploreName);
Indietro
String : il nome dell'esplorazione di Looker.
getInstanceUrl()
Ottiene l'URL dell'istanza di Looker.
// TODO(developer): Replace the URL with your own. const ss = SpreadsheetApp.openByUrl( 'https://docs.google.com/spreadsheets/d/abc123456/edit', ); const lookerDataSourceSpec = ss.getDataSources()[0].getSpec().asLooker(); const instanceUrl = lookerDataSourceSpec.getInstanceUrl(); Logger.log(instanceUrl);
Indietro
String : l'URL dell'istanza di Looker.
getModelName()
Ottiene il nome del modello di Looker nell'istanza.
// TODO(developer): Replace the URL with your own. const ss = SpreadsheetApp.openByUrl( 'https://docs.google.com/spreadsheets/d/abc123456/edit', ); const lookerDataSourceSpec = ss.getDataSources()[0].getSpec().asLooker(); const modelName = lookerDataSourceSpec.getModelName(); Logger.log(modelName);
Indietro
String : il nome del modello di Looker.
getParameters()
Ottiene i parametri dell'origine dati.
// TODO(developer): Replace the URL with your own. const ss = SpreadsheetApp.openByUrl( 'https://docs.google.com/spreadsheets/d/abc123456/edit', ); const spec = ss.getDataSources()[0].getSpec(); const parameters = spec.getParameters();
Questo metodo è disponibile solo per le origini dati BigQuery.
Indietro
DataSourceParameter[] : l'elenco dei parametri.
getType()
Ottiene il tipo di origine dati.
// TODO(developer): Replace the URL with your own. const ss = SpreadsheetApp.openByUrl( 'https://docs.google.com/spreadsheets/d/abc123456/edit', ); const spec = ss.getDataSources()[0].getSpec(); const type = spec.getType();
Indietro
DataSourceType : il tipo di origine dati.