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
48 changes: 48 additions & 0 deletions features/v2/reference_tables.feature
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,30 @@ Feature: Reference Tables
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/redapl-experiences
Scenario: Delete rows returns "Bad Request" response
Given new "DeleteRows" request
And request contains "id" parameter from "REPLACE.ME"
And body with value {"data": [{"id": "primary_key_value", "type": "row"}]}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/redapl-experiences
Scenario: Delete rows returns "Not Found" response
Given new "DeleteRows" request
And request contains "id" parameter from "REPLACE.ME"
And body with value {"data": [{"id": "primary_key_value", "type": "row"}]}
When the request is sent
Then the response status is 404 Not Found

@generated @skip @team:DataDog/redapl-experiences
Scenario: Delete rows returns "Rows deleted successfully" response
Given new "DeleteRows" request
And request contains "id" parameter from "REPLACE.ME"
And body with value {"data": [{"id": "primary_key_value", "type": "row"}]}
When the request is sent
Then the response status is 200 Rows deleted successfully

@generated @skip @team:DataDog/redapl-experiences
Scenario: Delete table returns "Not Found" response
Given new "DeleteTable" request
Expand Down Expand Up @@ -119,3 +143,27 @@ Feature: Reference Tables
And body with value {"data": {"attributes": {"description": "this is a cloud table generated via a cloud bucket sync", "file_metadata": {"access_details": {"aws_detail": {"aws_account_id": "test-account-id", "aws_bucket_name": "test-bucket", "file_path": "test_rt.csv"}}, "sync_enabled": true}, "schema": {"fields": [{"name": "id", "type": "INT32"}, {"name": "name", "type": "STRING"}], "primary_keys": ["id"]}, "sync_enabled": false, "tags": ["test_tag"]}, "type": "reference_table"}}
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/redapl-experiences
Scenario: Upsert rows returns "Bad Request" response
Given new "UpsertRows" request
And request contains "id" parameter from "REPLACE.ME"
And body with value {"data": [{"attributes": {"values": {"example_key_value": "primary_key_value", "name": "row_name"}}, "id": "primary_key_value", "type": "row"}]}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/redapl-experiences
Scenario: Upsert rows returns "Not Found" response
Given new "UpsertRows" request
And request contains "id" parameter from "REPLACE.ME"
And body with value {"data": [{"attributes": {"values": {"example_key_value": "primary_key_value", "name": "row_name"}}, "id": "primary_key_value", "type": "row"}]}
When the request is sent
Then the response status is 404 Not Found

@generated @skip @team:DataDog/redapl-experiences
Scenario: Upsert rows returns "Rows created or updated successfully" response
Given new "UpsertRows" request
And request contains "id" parameter from "REPLACE.ME"
And body with value {"data": [{"attributes": {"values": {"example_key_value": "primary_key_value", "name": "row_name"}}, "id": "primary_key_value", "type": "row"}]}
When the request is sent
Then the response status is 200 Rows created or updated successfully
14 changes: 14 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -3089,12 +3089,26 @@
"type": "idempotent"
}
},
"DeleteRows": {
"tag": "Reference Tables",
"undo": {
"type": "idempotent"
}
},
"GetRowsByID": {
"tag": "Reference Tables",
"undo": {
"type": "safe"
}
},
"UpsertRows": {
"tag": "Reference Tables",
"undo": {
"operationId": "DeleteRows",
"parameters": [],
"type": "unsafe"
}
},
"CreateReferenceTableUpload": {
"tag": "Reference Tables",
"undo": {
Expand Down
22 changes: 22 additions & 0 deletions private/bdd_runner/src/support/scenarios_model_mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7801,6 +7801,28 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = {
},
operationResponseType: "TableRowResourceArray",
},
"ReferenceTablesApi.V2.UpsertRows": {
id: {
type: "string",
format: "",
},
body: {
type: "BatchUpsertRowsRequestArray",
format: "",
},
operationResponseType: "{}",
},
"ReferenceTablesApi.V2.DeleteRows": {
id: {
type: "string",
format: "",
},
body: {
type: "BatchDeleteRowsRequestArray",
format: "",
},
operationResponseType: "{}",
},
"ReferenceTablesApi.V2.CreateReferenceTableUpload": {
body: {
type: "CreateUploadRequest",
Expand Down
Loading