Skip to content

Commit ab6eca5

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add Batch Rows Query Endpoint to Reference Tables API spec (#3304)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 41745a2 commit ab6eca5

18 files changed

+693
-19
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 135 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7475,23 +7475,89 @@ components:
74757475
properties:
74767476
data:
74777477
items:
7478-
$ref: '#/components/schemas/BatchDeleteRowsRequestData'
7478+
$ref: '#/components/schemas/TableRowResourceIdentifier'
74797479
maxItems: 200
74807480
type: array
74817481
required:
74827482
- data
74837483
type: object
7484-
BatchDeleteRowsRequestData:
7485-
description: Row resource containing a single row identifier for deletion.
7484+
BatchRowsQueryDataType:
7485+
default: reference-tables-batch-rows-query
7486+
description: Resource type identifier for batch queries of reference table rows.
7487+
enum:
7488+
- reference-tables-batch-rows-query
7489+
example: reference-tables-batch-rows-query
7490+
type: string
7491+
x-enum-varnames:
7492+
- REFERENCE_TABLES_BATCH_ROWS_QUERY
7493+
BatchRowsQueryRequest:
7494+
properties:
7495+
data:
7496+
$ref: '#/components/schemas/BatchRowsQueryRequestData'
7497+
type: object
7498+
BatchRowsQueryRequestData:
7499+
properties:
7500+
attributes:
7501+
$ref: '#/components/schemas/BatchRowsQueryRequestDataAttributes'
7502+
type:
7503+
$ref: '#/components/schemas/BatchRowsQueryDataType'
7504+
required:
7505+
- type
7506+
type: object
7507+
BatchRowsQueryRequestDataAttributes:
7508+
properties:
7509+
row_ids:
7510+
example:
7511+
- row_id_1
7512+
- row_id_2
7513+
items:
7514+
type: string
7515+
type: array
7516+
table_id:
7517+
example: 00000000-0000-0000-0000-000000000000
7518+
type: string
7519+
required:
7520+
- row_ids
7521+
- table_id
7522+
type: object
7523+
BatchRowsQueryResponse:
7524+
example:
7525+
data:
7526+
id: 00000000-0000-0000-0000-000000000000
7527+
relationships:
7528+
rows:
7529+
data:
7530+
- id: row_id_1
7531+
type: row
7532+
- id: row_id_2
7533+
type: row
7534+
type: reference-tables-batch-rows-query
7535+
properties:
7536+
data:
7537+
$ref: '#/components/schemas/BatchRowsQueryResponseData'
7538+
type: object
7539+
BatchRowsQueryResponseData:
74867540
properties:
74877541
id:
7488-
example: primary_key_value
74897542
type: string
7543+
relationships:
7544+
$ref: '#/components/schemas/BatchRowsQueryResponseDataRelationships'
74907545
type:
7491-
$ref: '#/components/schemas/TableRowResourceDataType'
7546+
$ref: '#/components/schemas/BatchRowsQueryDataType'
74927547
required:
74937548
- type
7494-
- id
7549+
type: object
7550+
BatchRowsQueryResponseDataRelationships:
7551+
properties:
7552+
rows:
7553+
$ref: '#/components/schemas/BatchRowsQueryResponseDataRelationshipsRows'
7554+
type: object
7555+
BatchRowsQueryResponseDataRelationshipsRows:
7556+
properties:
7557+
data:
7558+
items:
7559+
$ref: '#/components/schemas/TableRowResourceIdentifier'
7560+
type: array
74957561
type: object
74967562
BatchUpsertRowsRequestArray:
74977563
description: The request body for creating or updating multiple rows into a
@@ -66953,6 +67019,18 @@ components:
6695367019
type: string
6695467020
x-enum-varnames:
6695567021
- ROW
67022+
TableRowResourceIdentifier:
67023+
description: Row resource containing a single row identifier.
67024+
properties:
67025+
id:
67026+
example: primary_key_value
67027+
type: string
67028+
type:
67029+
$ref: '#/components/schemas/TableRowResourceDataType'
67030+
required:
67031+
- type
67032+
- id
67033+
type: object
6695667034
TagsEventAttribute:
6695767035
description: Array of tags associated with your event.
6695867036
example:
@@ -96388,6 +96466,57 @@ paths:
9638896466
operator: OR
9638996467
permissions:
9639096468
- timeseries_query
96469+
/api/v2/reference-tables/queries/batch-rows:
96470+
post:
96471+
description: Batch query reference table rows by their primary key values. Returns
96472+
only found rows in the included array.
96473+
operationId: BatchRowsQuery
96474+
requestBody:
96475+
content:
96476+
application/json:
96477+
examples:
96478+
happy_path:
96479+
summary: Batch query reference table rows by their primary key values.
96480+
value:
96481+
data:
96482+
attributes:
96483+
row_ids:
96484+
- row_id_1
96485+
- row_id_2
96486+
table_id: 00000000-0000-0000-0000-000000000000
96487+
type: reference-tables-batch-rows-query
96488+
schema:
96489+
$ref: '#/components/schemas/BatchRowsQueryRequest'
96490+
required: true
96491+
responses:
96492+
'200':
96493+
content:
96494+
application/json:
96495+
schema:
96496+
$ref: '#/components/schemas/BatchRowsQueryResponse'
96497+
description: Successfully retrieved rows. Some or all requested rows were
96498+
found. Response includes found rows in the included section.
96499+
'400':
96500+
$ref: '#/components/responses/BadRequestResponse'
96501+
'403':
96502+
$ref: '#/components/responses/ForbiddenResponse'
96503+
'404':
96504+
$ref: '#/components/responses/NotFoundResponse'
96505+
'429':
96506+
$ref: '#/components/responses/TooManyRequestsResponse'
96507+
'500':
96508+
content:
96509+
application/json:
96510+
schema:
96511+
$ref: '#/components/schemas/APIErrorResponse'
96512+
description: Internal Server Error
96513+
security:
96514+
- apiKeyAuth: []
96515+
appKeyAuth: []
96516+
- AuthZ: []
96517+
summary: Batch rows query
96518+
tags:
96519+
- Reference Tables
9639196520
/api/v2/reference-tables/tables:
9639296521
get:
9639396522
description: List all reference tables in this organization.

docs/datadog_api_client.v2.model.rst

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2769,10 +2769,59 @@ datadog\_api\_client.v2.model.batch\_delete\_rows\_request\_array module
27692769
:members:
27702770
:show-inheritance:
27712771

2772-
datadog\_api\_client.v2.model.batch\_delete\_rows\_request\_data module
2772+
datadog\_api\_client.v2.model.batch\_rows\_query\_data\_type module
2773+
-------------------------------------------------------------------
2774+
2775+
.. automodule:: datadog_api_client.v2.model.batch_rows_query_data_type
2776+
:members:
2777+
:show-inheritance:
2778+
2779+
datadog\_api\_client.v2.model.batch\_rows\_query\_request module
2780+
----------------------------------------------------------------
2781+
2782+
.. automodule:: datadog_api_client.v2.model.batch_rows_query_request
2783+
:members:
2784+
:show-inheritance:
2785+
2786+
datadog\_api\_client.v2.model.batch\_rows\_query\_request\_data module
2787+
----------------------------------------------------------------------
2788+
2789+
.. automodule:: datadog_api_client.v2.model.batch_rows_query_request_data
2790+
:members:
2791+
:show-inheritance:
2792+
2793+
datadog\_api\_client.v2.model.batch\_rows\_query\_request\_data\_attributes module
2794+
----------------------------------------------------------------------------------
2795+
2796+
.. automodule:: datadog_api_client.v2.model.batch_rows_query_request_data_attributes
2797+
:members:
2798+
:show-inheritance:
2799+
2800+
datadog\_api\_client.v2.model.batch\_rows\_query\_response module
2801+
-----------------------------------------------------------------
2802+
2803+
.. automodule:: datadog_api_client.v2.model.batch_rows_query_response
2804+
:members:
2805+
:show-inheritance:
2806+
2807+
datadog\_api\_client.v2.model.batch\_rows\_query\_response\_data module
27732808
-----------------------------------------------------------------------
27742809

2775-
.. automodule:: datadog_api_client.v2.model.batch_delete_rows_request_data
2810+
.. automodule:: datadog_api_client.v2.model.batch_rows_query_response_data
2811+
:members:
2812+
:show-inheritance:
2813+
2814+
datadog\_api\_client.v2.model.batch\_rows\_query\_response\_data\_relationships module
2815+
--------------------------------------------------------------------------------------
2816+
2817+
.. automodule:: datadog_api_client.v2.model.batch_rows_query_response_data_relationships
2818+
:members:
2819+
:show-inheritance:
2820+
2821+
datadog\_api\_client.v2.model.batch\_rows\_query\_response\_data\_relationships\_rows module
2822+
--------------------------------------------------------------------------------------------
2823+
2824+
.. automodule:: datadog_api_client.v2.model.batch_rows_query_response_data_relationships_rows
27762825
:members:
27772826
:show-inheritance:
27782827

@@ -29306,6 +29355,13 @@ datadog\_api\_client.v2.model.table\_row\_resource\_data\_type module
2930629355
:members:
2930729356
:show-inheritance:
2930829357

29358+
datadog\_api\_client.v2.model.table\_row\_resource\_identifier module
29359+
---------------------------------------------------------------------
29360+
29361+
.. automodule:: datadog_api_client.v2.model.table_row_resource_identifier
29362+
:members:
29363+
:show-inheritance:
29364+
2930929365
datadog\_api\_client.v2.model.tags\_event\_attribute module
2931029366
-----------------------------------------------------------
2931129367

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"""
2+
Batch rows query returns "Successfully retrieved rows. Some or all requested rows were found. Response includes found
3+
rows in the included section." response
4+
"""
5+
6+
from datadog_api_client import ApiClient, Configuration
7+
from datadog_api_client.v2.api.reference_tables_api import ReferenceTablesApi
8+
from datadog_api_client.v2.model.batch_rows_query_data_type import BatchRowsQueryDataType
9+
from datadog_api_client.v2.model.batch_rows_query_request import BatchRowsQueryRequest
10+
from datadog_api_client.v2.model.batch_rows_query_request_data import BatchRowsQueryRequestData
11+
from datadog_api_client.v2.model.batch_rows_query_request_data_attributes import BatchRowsQueryRequestDataAttributes
12+
13+
body = BatchRowsQueryRequest(
14+
data=BatchRowsQueryRequestData(
15+
attributes=BatchRowsQueryRequestDataAttributes(
16+
row_ids=[
17+
"row_id_1",
18+
"row_id_2",
19+
],
20+
table_id="00000000-0000-0000-0000-000000000000",
21+
),
22+
type=BatchRowsQueryDataType.REFERENCE_TABLES_BATCH_ROWS_QUERY,
23+
),
24+
)
25+
26+
configuration = Configuration()
27+
with ApiClient(configuration) as api_client:
28+
api_instance = ReferenceTablesApi(api_client)
29+
response = api_instance.batch_rows_query(body=body)
30+
31+
print(response)

examples/v2/reference-tables/DeleteRows.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
from datadog_api_client import ApiClient, Configuration
66
from datadog_api_client.v2.api.reference_tables_api import ReferenceTablesApi
77
from datadog_api_client.v2.model.batch_delete_rows_request_array import BatchDeleteRowsRequestArray
8-
from datadog_api_client.v2.model.batch_delete_rows_request_data import BatchDeleteRowsRequestData
98
from datadog_api_client.v2.model.table_row_resource_data_type import TableRowResourceDataType
9+
from datadog_api_client.v2.model.table_row_resource_identifier import TableRowResourceIdentifier
1010

1111
body = BatchDeleteRowsRequestArray(
1212
data=[
13-
BatchDeleteRowsRequestData(
13+
TableRowResourceIdentifier(
1414
id="primary_key_value",
1515
type=TableRowResourceDataType.ROW,
1616
),

src/datadog_api_client/v2/api/reference_tables_api.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
UnsetType,
1212
unset,
1313
)
14+
from datadog_api_client.v2.model.batch_rows_query_response import BatchRowsQueryResponse
15+
from datadog_api_client.v2.model.batch_rows_query_request import BatchRowsQueryRequest
1416
from datadog_api_client.v2.model.table_result_v2_array import TableResultV2Array
1517
from datadog_api_client.v2.model.reference_table_sort_type import ReferenceTableSortType
1618
from datadog_api_client.v2.model.table_result_v2 import TableResultV2
@@ -33,6 +35,26 @@ def __init__(self, api_client=None):
3335
api_client = ApiClient(Configuration())
3436
self.api_client = api_client
3537

38+
self._batch_rows_query_endpoint = _Endpoint(
39+
settings={
40+
"response_type": (BatchRowsQueryResponse,),
41+
"auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"],
42+
"endpoint_path": "/api/v2/reference-tables/queries/batch-rows",
43+
"operation_id": "batch_rows_query",
44+
"http_method": "POST",
45+
"version": "v2",
46+
},
47+
params_map={
48+
"body": {
49+
"required": True,
50+
"openapi_types": (BatchRowsQueryRequest,),
51+
"location": "body",
52+
},
53+
},
54+
headers_map={"accept": ["application/json"], "content_type": ["application/json"]},
55+
api_client=api_client,
56+
)
57+
3658
self._create_reference_table_endpoint = _Endpoint(
3759
settings={
3860
"response_type": (TableResultV2,),
@@ -281,6 +303,22 @@ def __init__(self, api_client=None):
281303
api_client=api_client,
282304
)
283305

306+
def batch_rows_query(
307+
self,
308+
body: BatchRowsQueryRequest,
309+
) -> BatchRowsQueryResponse:
310+
"""Batch rows query.
311+
312+
Batch query reference table rows by their primary key values. Returns only found rows in the included array.
313+
314+
:type body: BatchRowsQueryRequest
315+
:rtype: BatchRowsQueryResponse
316+
"""
317+
kwargs: Dict[str, Any] = {}
318+
kwargs["body"] = body
319+
320+
return self._batch_rows_query_endpoint.call_with_http_info(**kwargs)
321+
284322
def create_reference_table(
285323
self,
286324
body: CreateTableRequest,

src/datadog_api_client/v2/model/batch_delete_rows_request_array.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414
if TYPE_CHECKING:
15-
from datadog_api_client.v2.model.batch_delete_rows_request_data import BatchDeleteRowsRequestData
15+
from datadog_api_client.v2.model.table_row_resource_identifier import TableRowResourceIdentifier
1616

1717

1818
class BatchDeleteRowsRequestArray(ModelNormal):
@@ -24,22 +24,22 @@ class BatchDeleteRowsRequestArray(ModelNormal):
2424

2525
@cached_property
2626
def openapi_types(_):
27-
from datadog_api_client.v2.model.batch_delete_rows_request_data import BatchDeleteRowsRequestData
27+
from datadog_api_client.v2.model.table_row_resource_identifier import TableRowResourceIdentifier
2828

2929
return {
30-
"data": ([BatchDeleteRowsRequestData],),
30+
"data": ([TableRowResourceIdentifier],),
3131
}
3232

3333
attribute_map = {
3434
"data": "data",
3535
}
3636

37-
def __init__(self_, data: List[BatchDeleteRowsRequestData], **kwargs):
37+
def __init__(self_, data: List[TableRowResourceIdentifier], **kwargs):
3838
"""
3939
The request body for deleting multiple rows from a reference table.
4040
4141
:param data:
42-
:type data: [BatchDeleteRowsRequestData]
42+
:type data: [TableRowResourceIdentifier]
4343
"""
4444
super().__init__(kwargs)
4545

0 commit comments

Comments
 (0)