List metric SQL models. Returns a paginated list of the SQL models that metrics are defined on for the organization.
This endpoint requires the product_analytics_metrics_read permission.
OAuth apps require the product_analytics_metrics_read authorization scope to access this endpoint.
Arguments
Query Strings
Name
Type
Description
include
array
Optional fields to include. Repeat this parameter to request several fields. counts adds metric_count
and experiment_count, which cost an extra aggregate query.
page[limit]
integer
Maximum number of results to return. Defaults to 25 when omitted, and is capped at 50 (larger values are clamped to 50). The response includes meta.page (with total) and pagination links.
page[offset]
integer
Number of results to skip for pagination. Defaults to 0 when omitted.
sort
string
Sort field: name, created_at, updated_at, metric_count, or experiment_count. A single field only; a
comma-separated list is rejected. Prefix with - for descending (for example, -created_at). Defaults to
created_at descending.
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"python3"example.py"
# List metric SQL models returns "OK" responserequire"datadog_api_client"DatadogAPIClient.configuredo|config|config.access_token=ENV["DD_BEARER_TOKEN"]endapi_instance=DatadogAPIClient::V2::ExperimentsAPI.newpapi_instance.list_metric_sql_models()
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"rb"example.rb"
// List metric SQL models returns "OK" responsepackagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())ctx=context.WithValue(ctx,datadog.ContextAccessToken,os.Getenv("DD_BEARER_TOKEN"))configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewExperimentsApi(apiClient)resp,r,err:=api.ListMetricSQLModels(ctx,*datadogV2.NewListMetricSQLModelsOptionalParameters())iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `ExperimentsApi.ListMetricSQLModels`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `ExperimentsApi.ListMetricSQLModels`:\n%s\n",responseContent)}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"go run"main.go"
// List metric SQL models returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.ExperimentsApi;importcom.datadog.api.client.v2.model.ExperimentsMetricSQLModelV2DTOArray;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));ExperimentsApiapiInstance=newExperimentsApi(defaultClient);try{ExperimentsMetricSQLModelV2DTOArrayresult=apiInstance.listMetricSQLModels();System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling ExperimentsApi#listMetricSQLModels");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"java"Example.java"
// List metric SQL models returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_experiments::ExperimentsAPI;usedatadog_api_client::datadogV2::api_experiments::ListMetricSQLModelsOptionalParams;#[tokio::main]asyncfnmain(){letconfiguration=datadog::Configuration::new();letapi=ExperimentsAPI::with_config(configuration);letresp=api.list_metric_sql_models(ListMetricSQLModelsOptionalParams::default()).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
Request a personalized demo
Get Started with Datadog
Ask AI
AI-generated responses may be inaccurate. Verify important info.