Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
149 changes: 149 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6806,6 +6806,72 @@ components:
required:
- data
type: object
BatchDeleteRowsRequestArray:
description: The request body for deleting multiple rows from a reference table.
properties:
data:
items:
$ref: '#/components/schemas/BatchDeleteRowsRequestData'
maxItems: 200
type: array
required:
- data
type: object
BatchDeleteRowsRequestData:
description: Row resource containing a single row identifier for deletion.
properties:
id:
example: primary_key_value
type: string
type:
$ref: '#/components/schemas/TableRowResourceDataType'
required:
- type
- id
type: object
BatchUpsertRowsRequestArray:
description: The request body for creating or updating multiple rows into a
reference table.
properties:
data:
items:
$ref: '#/components/schemas/BatchUpsertRowsRequestData'
maxItems: 200
type: array
required:
- data
type: object
BatchUpsertRowsRequestData:
description: Row resource containing a single row identifier and its column
values.
properties:
attributes:
$ref: '#/components/schemas/BatchUpsertRowsRequestDataAttributes'
id:
example: primary_key_value
type: string
type:
$ref: '#/components/schemas/TableRowResourceDataType'
required:
- type
- id
type: object
BatchUpsertRowsRequestDataAttributes:
description: Attributes containing row data values for row creation or update
operations.
properties:
values:
additionalProperties:
x-required-field: true
description: Key-value pairs representing row data, where keys are field
names from the schema.
example:
example_key_value: primary_key_value
name: row_name
type: object
required:
- values
type: object
BillConfig:
description: Bill config.
properties:
Expand Down Expand Up @@ -74549,6 +74615,47 @@ paths:
tags:
- Reference Tables
/api/v2/reference-tables/tables/{id}/rows:
delete:
description: Delete multiple rows from a Reference Table by their primary key
values.
operationId: DeleteRows
parameters:
- description: Unique identifier of the reference table to delete rows from
in: path
name: id
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/BatchDeleteRowsRequestArray'
required: true
responses:
'200':
description: Rows deleted successfully
'400':
$ref: '#/components/responses/BadRequestResponse'
'403':
$ref: '#/components/responses/ForbiddenResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
'500':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Internal Server Error
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ: []
summary: Delete rows
tags:
- Reference Tables
get:
description: Get reference table rows by their primary key values.
operationId: GetRowsByID
Expand Down Expand Up @@ -74593,6 +74700,48 @@ paths:
summary: Get rows by id
tags:
- Reference Tables
post:
description: Create or update rows in a Reference Table by their primary key
values. If a row with the specified primary key exists, it is updated; otherwise,
a new row is created.
operationId: UpsertRows
parameters:
- description: Unique identifier of the reference table to upsert rows into
in: path
name: id
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/BatchUpsertRowsRequestArray'
required: true
responses:
'200':
description: Rows created or updated successfully
'400':
$ref: '#/components/responses/BadRequestResponse'
'403':
$ref: '#/components/responses/ForbiddenResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
'500':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Internal Server Error
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ: []
summary: Upsert rows
tags:
- Reference Tables
/api/v2/reference-tables/uploads:
post:
description: Create a reference table upload for bulk data ingestion
Expand Down
35 changes: 35 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2461,6 +2461,41 @@ datadog\_api\_client.v2.model.azure\_uc\_configs\_response module
:members:
:show-inheritance:

datadog\_api\_client.v2.model.batch\_delete\_rows\_request\_array module
------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.batch_delete_rows_request_array
:members:
:show-inheritance:

datadog\_api\_client.v2.model.batch\_delete\_rows\_request\_data module
-----------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.batch_delete_rows_request_data
:members:
:show-inheritance:

datadog\_api\_client.v2.model.batch\_upsert\_rows\_request\_array module
------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.batch_upsert_rows_request_array
:members:
:show-inheritance:

datadog\_api\_client.v2.model.batch\_upsert\_rows\_request\_data module
-----------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.batch_upsert_rows_request_data
:members:
:show-inheritance:

datadog\_api\_client.v2.model.batch\_upsert\_rows\_request\_data\_attributes module
-----------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.batch_upsert_rows_request_data_attributes
:members:
:show-inheritance:

datadog\_api\_client.v2.model.bill\_config module
-------------------------------------------------

Expand Down
23 changes: 23 additions & 0 deletions examples/v2/reference-tables/DeleteRows.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""
Delete rows returns "Rows deleted successfully" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.reference_tables_api import ReferenceTablesApi
from datadog_api_client.v2.model.batch_delete_rows_request_array import BatchDeleteRowsRequestArray
from datadog_api_client.v2.model.batch_delete_rows_request_data import BatchDeleteRowsRequestData
from datadog_api_client.v2.model.table_row_resource_data_type import TableRowResourceDataType

body = BatchDeleteRowsRequestArray(
data=[
BatchDeleteRowsRequestData(
id="primary_key_value",
type=TableRowResourceDataType.ROW,
),
],
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = ReferenceTablesApi(api_client)
api_instance.delete_rows(id="id", body=body)
30 changes: 30 additions & 0 deletions examples/v2/reference-tables/UpsertRows.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""
Upsert rows returns "Rows created or updated successfully" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.reference_tables_api import ReferenceTablesApi
from datadog_api_client.v2.model.batch_upsert_rows_request_array import BatchUpsertRowsRequestArray
from datadog_api_client.v2.model.batch_upsert_rows_request_data import BatchUpsertRowsRequestData
from datadog_api_client.v2.model.batch_upsert_rows_request_data_attributes import BatchUpsertRowsRequestDataAttributes
from datadog_api_client.v2.model.table_row_resource_data_type import TableRowResourceDataType

body = BatchUpsertRowsRequestArray(
data=[
BatchUpsertRowsRequestData(
attributes=BatchUpsertRowsRequestDataAttributes(
values=dict(
example_key_value="primary_key_value",
name="row_name",
),
),
id="primary_key_value",
type=TableRowResourceDataType.ROW,
),
],
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = ReferenceTablesApi(api_client)
api_instance.upsert_rows(id="id", body=body)
96 changes: 96 additions & 0 deletions src/datadog_api_client/v2/api/reference_tables_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
from datadog_api_client.v2.model.table_result_v2 import TableResultV2
from datadog_api_client.v2.model.create_table_request import CreateTableRequest
from datadog_api_client.v2.model.patch_table_request import PatchTableRequest
from datadog_api_client.v2.model.batch_delete_rows_request_array import BatchDeleteRowsRequestArray
from datadog_api_client.v2.model.table_row_resource_array import TableRowResourceArray
from datadog_api_client.v2.model.batch_upsert_rows_request_array import BatchUpsertRowsRequestArray
from datadog_api_client.v2.model.create_upload_response import CreateUploadResponse
from datadog_api_client.v2.model.create_upload_request import CreateUploadRequest

Expand Down Expand Up @@ -71,6 +73,32 @@ def __init__(self, api_client=None):
api_client=api_client,
)

self._delete_rows_endpoint = _Endpoint(
settings={
"response_type": None,
"auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"],
"endpoint_path": "/api/v2/reference-tables/tables/{id}/rows",
"operation_id": "delete_rows",
"http_method": "DELETE",
"version": "v2",
},
params_map={
"id": {
"required": True,
"openapi_types": (str,),
"attribute": "id",
"location": "path",
},
"body": {
"required": True,
"openapi_types": (BatchDeleteRowsRequestArray,),
"location": "body",
},
},
headers_map={"accept": ["*/*"], "content_type": ["application/json"]},
api_client=api_client,
)

self._delete_table_endpoint = _Endpoint(
settings={
"response_type": None,
Expand Down Expand Up @@ -227,6 +255,32 @@ def __init__(self, api_client=None):
api_client=api_client,
)

self._upsert_rows_endpoint = _Endpoint(
settings={
"response_type": None,
"auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"],
"endpoint_path": "/api/v2/reference-tables/tables/{id}/rows",
"operation_id": "upsert_rows",
"http_method": "POST",
"version": "v2",
},
params_map={
"id": {
"required": True,
"openapi_types": (str,),
"attribute": "id",
"location": "path",
},
"body": {
"required": True,
"openapi_types": (BatchUpsertRowsRequestArray,),
"location": "body",
},
},
headers_map={"accept": ["*/*"], "content_type": ["application/json"]},
api_client=api_client,
)

def create_reference_table(
self,
body: CreateTableRequest,
Expand Down Expand Up @@ -264,6 +318,27 @@ def create_reference_table_upload(

return self._create_reference_table_upload_endpoint.call_with_http_info(**kwargs)

def delete_rows(
self,
id: str,
body: BatchDeleteRowsRequestArray,
) -> None:
"""Delete rows.

Delete multiple rows from a Reference Table by their primary key values.

:param id: Unique identifier of the reference table to delete rows from
:type id: str
:type body: BatchDeleteRowsRequestArray
:rtype: None
"""
kwargs: Dict[str, Any] = {}
kwargs["id"] = id

kwargs["body"] = body

return self._delete_rows_endpoint.call_with_http_info(**kwargs)

def delete_table(
self,
id: str,
Expand Down Expand Up @@ -389,3 +464,24 @@ def update_reference_table(
kwargs["body"] = body

return self._update_reference_table_endpoint.call_with_http_info(**kwargs)

def upsert_rows(
self,
id: str,
body: BatchUpsertRowsRequestArray,
) -> None:
"""Upsert rows.

Create or update rows in a Reference Table by their primary key values. If a row with the specified primary key exists, it is updated; otherwise, a new row is created.

:param id: Unique identifier of the reference table to upsert rows into
:type id: str
:type body: BatchUpsertRowsRequestArray
:rtype: None
"""
kwargs: Dict[str, Any] = {}
kwargs["id"] = id

kwargs["body"] = body

return self._upsert_rows_endpoint.call_with_http_info(**kwargs)
Loading