Update a reference table by ID. You can update the table’s data, description, and tags. Note: The source type cannot be changed after table creation. For data updates: For existing tables of type source:LOCAL_FILE, call POST api/v2/reference-tables/uploads first to get an upload ID, then PUT chunks of CSV data to each provided URL, and finally call this PATCH endpoint with the upload_id in file_metadata. For existing tables with source: types of S3, GCS, or AZURE, provide updated access_details in file_metadata pointing to a CSV file in the same type of cloud storage.
Arguments
Path Parameters
Name
Type
Description
id [required]
string
Unique identifier of the reference table to update
The data object containing the partial table definition updates.
attributes
object
Attributes that define the updates to the reference table's configuration and properties.
description
string
Optional text describing the purpose or contents of this reference table.
file_metadata
<oneOf>
Metadata specifying where and how to access the reference table's data file.
Option 1
object
Cloud storage file metadata for patch requests. Allows partial updates of access_details and sync_enabled.
access_details
object
Cloud storage access configuration for the reference table data file.
aws_detail
object
Amazon Web Services S3 storage access configuration.
aws_account_id
string
AWS account ID where the S3 bucket is located.
aws_bucket_name
string
S3 bucket containing the CSV file.
file_path
string
The relative file path from the S3 bucket root to the CSV file.
azure_detail
object
Azure Blob Storage access configuration.
azure_client_id
string
Azure service principal (application) client ID with permissions to read from the container.
azure_container_name
string
Azure Blob Storage container containing the CSV file.
azure_storage_account_name
string
Azure storage account where the container is located.
azure_tenant_id
string
Azure Active Directory tenant ID.
file_path
string
The relative file path from the Azure container root to the CSV file.
gcp_detail
object
Google Cloud Platform storage access configuration.
file_path
string
The relative file path from the GCS bucket root to the CSV file.
gcp_bucket_name
string
GCP bucket containing the CSV file.
gcp_project_id
string
GCP project ID where the bucket is located.
gcp_service_account_email
string
Service account email with read permissions for the GCS bucket.
sync_enabled
boolean
Whether this table is synced automatically.
Option 2
object
Local file metadata for patch requests using upload ID.
upload_id [required]
string
The upload ID.
schema
object
Schema defining the updates to the structure and columns of the reference table. Schema fields cannot be deleted or renamed.
fields [required]
[object]
The schema fields.
name [required]
string
The field name.
type [required]
enum
The field type for reference table schema fields.
Allowed enum values: STRING,INT32
primary_keys [required]
[string]
List of field names that serve as primary keys for the table. Only one primary key is supported, and it is used as an ID to retrieve rows. Primary keys cannot be changed after table creation.
tags
[string]
Tags for organizing and filtering reference tables.
"""
Update reference table returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.reference_tables_apiimportReferenceTablesApifromdatadog_api_client.v2.model.patch_table_requestimportPatchTableRequestfromdatadog_api_client.v2.model.patch_table_request_dataimportPatchTableRequestDatafromdatadog_api_client.v2.model.patch_table_request_data_attributesimportPatchTableRequestDataAttributesfromdatadog_api_client.v2.model.patch_table_request_data_attributes_file_metadata_cloud_storageimport(PatchTableRequestDataAttributesFileMetadataCloudStorage,)fromdatadog_api_client.v2.model.patch_table_request_data_attributes_file_metadata_one_of_access_detailsimport(PatchTableRequestDataAttributesFileMetadataOneOfAccessDetails,)fromdatadog_api_client.v2.model.patch_table_request_data_attributes_file_metadata_one_of_access_details_aws_detailimport(PatchTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail,)fromdatadog_api_client.v2.model.patch_table_request_data_attributes_schemaimportPatchTableRequestDataAttributesSchemafromdatadog_api_client.v2.model.patch_table_request_data_attributes_schema_fields_itemsimport(PatchTableRequestDataAttributesSchemaFieldsItems,)fromdatadog_api_client.v2.model.patch_table_request_data_typeimportPatchTableRequestDataTypefromdatadog_api_client.v2.model.reference_table_schema_field_typeimportReferenceTableSchemaFieldTypebody=PatchTableRequest(data=PatchTableRequestData(attributes=PatchTableRequestDataAttributes(description="this is a cloud table generated via a cloud bucket sync",file_metadata=PatchTableRequestDataAttributesFileMetadataCloudStorage(access_details=PatchTableRequestDataAttributesFileMetadataOneOfAccessDetails(aws_detail=PatchTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail(aws_account_id="test-account-id",aws_bucket_name="test-bucket",file_path="test_rt.csv",),),sync_enabled=True,),schema=PatchTableRequestDataAttributesSchema(fields=[PatchTableRequestDataAttributesSchemaFieldsItems(name="id",type=ReferenceTableSchemaFieldType.INT32,),PatchTableRequestDataAttributesSchemaFieldsItems(name="name",type=ReferenceTableSchemaFieldType.STRING,),],primary_keys=["id",],),tags=["test_tag",],),type=PatchTableRequestDataType.REFERENCE_TABLE,),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=ReferenceTablesApi(api_client)api_instance.update_reference_table(id="id",body=body)
# Update reference table returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::ReferenceTablesAPI.newbody=DatadogAPIClient::V2::PatchTableRequest.new({data:DatadogAPIClient::V2::PatchTableRequestData.new({attributes:DatadogAPIClient::V2::PatchTableRequestDataAttributes.new({description:"this is a cloud table generated via a cloud bucket sync",file_metadata:DatadogAPIClient::V2::PatchTableRequestDataAttributesFileMetadataCloudStorage.new({access_details:DatadogAPIClient::V2::PatchTableRequestDataAttributesFileMetadataOneOfAccessDetails.new({aws_detail:DatadogAPIClient::V2::PatchTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail.new({aws_account_id:"test-account-id",aws_bucket_name:"test-bucket",file_path:"test_rt.csv",}),}),sync_enabled:true,}),schema:DatadogAPIClient::V2::PatchTableRequestDataAttributesSchema.new({fields:[DatadogAPIClient::V2::PatchTableRequestDataAttributesSchemaFieldsItems.new({name:"id",type:DatadogAPIClient::V2::ReferenceTableSchemaFieldType::INT32,}),DatadogAPIClient::V2::PatchTableRequestDataAttributesSchemaFieldsItems.new({name:"name",type:DatadogAPIClient::V2::ReferenceTableSchemaFieldType::STRING,}),],primary_keys:["id",],}),tags:["test_tag",],}),type:DatadogAPIClient::V2::PatchTableRequestDataType::REFERENCE_TABLE,}),})papi_instance.update_reference_table("id",body)
// Update reference table returns "OK" responsepackagemainimport("context""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){body:=datadogV2.PatchTableRequest{Data:&datadogV2.PatchTableRequestData{Attributes:&datadogV2.PatchTableRequestDataAttributes{Description:datadog.PtrString("this is a cloud table generated via a cloud bucket sync"),FileMetadata:&datadogV2.PatchTableRequestDataAttributesFileMetadata{PatchTableRequestDataAttributesFileMetadataCloudStorage:&datadogV2.PatchTableRequestDataAttributesFileMetadataCloudStorage{AccessDetails:&datadogV2.PatchTableRequestDataAttributesFileMetadataOneOfAccessDetails{AwsDetail:&datadogV2.PatchTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail{AwsAccountId:datadog.PtrString("test-account-id"),AwsBucketName:datadog.PtrString("test-bucket"),FilePath:datadog.PtrString("test_rt.csv"),},},SyncEnabled:datadog.PtrBool(true),}},Schema:&datadogV2.PatchTableRequestDataAttributesSchema{Fields:[]datadogV2.PatchTableRequestDataAttributesSchemaFieldsItems{{Name:"id",Type:datadogV2.REFERENCETABLESCHEMAFIELDTYPE_INT32,},{Name:"name",Type:datadogV2.REFERENCETABLESCHEMAFIELDTYPE_STRING,},},PrimaryKeys:[]string{"id",},},Tags:[]string{"test_tag",},},Type:datadogV2.PATCHTABLEREQUESTDATATYPE_REFERENCE_TABLE,},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewReferenceTablesApi(apiClient)r,err:=api.UpdateReferenceTable(ctx,"id",body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `ReferenceTablesApi.UpdateReferenceTable`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}}
// Update reference table returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.ReferenceTablesApi;importcom.datadog.api.client.v2.model.PatchTableRequest;importcom.datadog.api.client.v2.model.PatchTableRequestData;importcom.datadog.api.client.v2.model.PatchTableRequestDataAttributes;importcom.datadog.api.client.v2.model.PatchTableRequestDataAttributesFileMetadata;importcom.datadog.api.client.v2.model.PatchTableRequestDataAttributesFileMetadataCloudStorage;importcom.datadog.api.client.v2.model.PatchTableRequestDataAttributesFileMetadataOneOfAccessDetails;importcom.datadog.api.client.v2.model.PatchTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail;importcom.datadog.api.client.v2.model.PatchTableRequestDataAttributesSchema;importcom.datadog.api.client.v2.model.PatchTableRequestDataAttributesSchemaFieldsItems;importcom.datadog.api.client.v2.model.PatchTableRequestDataType;importcom.datadog.api.client.v2.model.ReferenceTableSchemaFieldType;importjava.util.Arrays;importjava.util.Collections;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();ReferenceTablesApiapiInstance=newReferenceTablesApi(defaultClient);PatchTableRequestbody=newPatchTableRequest().data(newPatchTableRequestData().attributes(newPatchTableRequestDataAttributes().description("this is a cloud table generated via a cloud bucket sync").fileMetadata(newPatchTableRequestDataAttributesFileMetadata(newPatchTableRequestDataAttributesFileMetadataCloudStorage().accessDetails(newPatchTableRequestDataAttributesFileMetadataOneOfAccessDetails().awsDetail(newPatchTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail().awsAccountId("test-account-id").awsBucketName("test-bucket").filePath("test_rt.csv"))).syncEnabled(true))).schema(newPatchTableRequestDataAttributesSchema().fields(Arrays.asList(newPatchTableRequestDataAttributesSchemaFieldsItems().name("id").type(ReferenceTableSchemaFieldType.INT32),newPatchTableRequestDataAttributesSchemaFieldsItems().name("name").type(ReferenceTableSchemaFieldType.STRING))).primaryKeys(Collections.singletonList("id"))).tags(Collections.singletonList("test_tag"))).type(PatchTableRequestDataType.REFERENCE_TABLE));try{apiInstance.updateReferenceTable("id",body);}catch(ApiExceptione){System.err.println("Exception when calling ReferenceTablesApi#updateReferenceTable");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Update reference table returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_reference_tables::ReferenceTablesAPI;usedatadog_api_client::datadogV2::model::PatchTableRequest;usedatadog_api_client::datadogV2::model::PatchTableRequestData;usedatadog_api_client::datadogV2::model::PatchTableRequestDataAttributes;usedatadog_api_client::datadogV2::model::PatchTableRequestDataAttributesFileMetadata;usedatadog_api_client::datadogV2::model::PatchTableRequestDataAttributesFileMetadataCloudStorage;usedatadog_api_client::datadogV2::model::PatchTableRequestDataAttributesFileMetadataOneOfAccessDetails;usedatadog_api_client::datadogV2::model::PatchTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail;usedatadog_api_client::datadogV2::model::PatchTableRequestDataAttributesSchema;usedatadog_api_client::datadogV2::model::PatchTableRequestDataAttributesSchemaFieldsItems;usedatadog_api_client::datadogV2::model::PatchTableRequestDataType;usedatadog_api_client::datadogV2::model::ReferenceTableSchemaFieldType;#[tokio::main]asyncfnmain(){letbody=PatchTableRequest::new().data(PatchTableRequestData::new(PatchTableRequestDataType::REFERENCE_TABLE,).attributes(PatchTableRequestDataAttributes::new().description("this is a cloud table generated via a cloud bucket sync".to_string()).file_metadata(PatchTableRequestDataAttributesFileMetadata::PatchTableRequestDataAttributesFileMetadataCloudStorage(Box::new(PatchTableRequestDataAttributesFileMetadataCloudStorage::new().access_details(PatchTableRequestDataAttributesFileMetadataOneOfAccessDetails::new().aws_detail(PatchTableRequestDataAttributesFileMetadataOneOfAccessDetailsAwsDetail::new().aws_account_id("test-account-id".to_string()).aws_bucket_name("test-bucket".to_string()).file_path("test_rt.csv".to_string()),),).sync_enabled(true),),),).schema(PatchTableRequestDataAttributesSchema::new(vec![PatchTableRequestDataAttributesSchemaFieldsItems::new("id".to_string(),ReferenceTableSchemaFieldType::INT32,),PatchTableRequestDataAttributesSchemaFieldsItems::new("name".to_string(),ReferenceTableSchemaFieldType::STRING,)],vec!["id".to_string()],),).tags(vec!["test_tag".to_string()]),),);letconfiguration=datadog::Configuration::new();letapi=ReferenceTablesAPI::with_config(configuration);letresp=api.update_reference_table("id".to_string(),body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Update reference table returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.ReferenceTablesApi(configuration);constparams: v2.ReferenceTablesApiUpdateReferenceTableRequest={body:{data:{attributes:{description:"this is a cloud table generated via a cloud bucket sync",fileMetadata:{accessDetails:{awsDetail:{awsAccountId:"test-account-id",awsBucketName:"test-bucket",filePath:"test_rt.csv",},},syncEnabled: true,},schema:{fields:[{name:"id",type:"INT32",},{name:"name",type:"STRING",},],primaryKeys:["id"],},tags:["test_tag"],},type:"reference_table",},},id:"id",};apiInstance.updateReferenceTable(params).then((data: any)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));