cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Delta Live Tables - RETRY_ON_FAILURE

GuMart
New Contributor III

Hi,

Is it possible to set it up the RETRY_ON_FAILURE property for DLTs through the API?

I'm not finding in the Docs (although it seems to exist in a response payload).

https://docs.databricks.com/delta-live-tables/api-guide.html

2 REPLIES 2

Anonymous
Not applicable

@Gustavo Martinsโ€‹ :

Yes, you can set the RETRY_ON_FAILURE property for a Delta Live Table (DLT) using the API. You can set the retry_on_failure parameter when creating or updating a DLT using the dlt.create or dlt.update API calls respectively. Here's an example of how you can set the retry_on_failure property to true:

import requests
import json
 
api_token = '<YOUR_API_TOKEN>'
endpoint = 'https://<YOUR_DATABRICKS_INSTANCE>/api/2.0/preview/dlt'
 
table_name = 'my_table'
retry_on_failure = True
 
# Set up the request data
request_data = {
    'table_name': table_name,
    'retry_on_failure': retry_on_failure
}
 
# Set up the request headers
headers = {
    'Authorization': f'Bearer {api_token}',
    'Content-Type': 'application/json'
}
 
# Create the DLT
response = requests.post(endpoint + '/create', headers=headers, data=json.dumps(request_data))
 
# Check the response
if response.ok:
    print('DLT created successfully')
else:
    print('DLT creation failed with status code', response.status_code, response.text)

Similarly, you can update the retry_on_failure property of an existing DLT using the dlt.update API call.

Here's an example of how you can update the retry_on_failure property of an existing DLT:

import requests
import json
 
api_token = '<YOUR_API_TOKEN>'
endpoint = 'https://<YOUR_DATABRICKS_INSTANCE>/api/2.0/preview/dlt'
 
table_name = 'my_table'
retry_on_failure = True
 
# Set up the request data
request_data = {
    'table_name': table_name,
    'retry_on_failure': retry_on_failure
}
 
# Set up the request headers
headers = {
    'Authorization': f'Bearer {api_token}',
    'Content-Type': 'application/json'
}
 
# Update the DLT
response = requests.post(endpoint + '/update', headers=headers, data=json.dumps(request_data))
 
# Check the response
if response.ok:
    print('DLT updated successfully')
else:
    print('DLT update failed with status code', response.status_code, response.text)

GuMart
New Contributor III

Hi @Suteja Kanuriโ€‹ ,

Thank you so much for the quick and complete answer!

Regards,

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group