Database Destinations

A Database Destination lets an Automation append rows to an existing table. Each destination references a credential in the Secret Store.

List Database Destinations

SDK Function

DatabaseDestination.list()

Return Object

ListIterator<DatabaseDestination>

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

Additional Arguments

Example Request

import com.files.ListIterator;
import com.files.exceptions.*;
import com.files.exceptions.ApiErrorException.*;
import com.files.models.DatabaseDestination;

try {
  HashMap<String, Object> parameters = new HashMap<>();
  ListIterator<DatabaseDestination> databaseDestinations = DatabaseDestination.list(parameters);
  for (DatabaseDestination databaseDestination : databaseDestinations.listAutoPaging()) {
    // Operate on databaseDestination
  }
} catch (NotAuthenticatedException e) {
  System.out.println("Authentication Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
} catch (SdkException e) {
  System.out.println("Unknown Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
}

Show Database Destination

SDK Function

DatabaseDestination.find()

Return Object

DatabaseDestination

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

Function Arguments

ArgumentDescription
id
int64
Required
Database Destination ID.

Example Request

import com.files.exceptions.*;
import com.files.exceptions.ApiErrorException.*;
import com.files.models.DatabaseDestination;

try {
  HashMap<String, Object> parameters = new HashMap<>();
  DatabaseDestination databaseDestination = DatabaseDestination.find(id, parameters);
  // Operate on databaseDestination
} catch (NotAuthenticatedException e) {
  System.out.println("Authentication Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
} catch (SdkException e) {
  System.out.println("Unknown Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
}

Create Database Destination

SDK Function

DatabaseDestination.create()

Return Object

DatabaseDestination

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

Function Arguments

ArgumentDefaultDescription
name
string
Required
Name of the destination.
provider
string
Required
Database provider.
Possible values: snowflake, bigquery, supabase, postgresql, mysql
config
object
Required
Provider settings for the destination. Use the schema matching provider. The connection address and table are fixed after creation.
secret_id
int64
Required
ID of a Secret in the same Workspace. Use a Token Secret for Snowflake, a service account Key/Value Secret for BigQuery, or a Username/Password Secret for a database login.
workspace_id
int64
0Workspace ID. 0 means the default workspace.

Example Request

import com.files.exceptions.*;
import com.files.exceptions.ApiErrorException.*;
import com.files.models.DatabaseDestination;

try {
  HashMap<String, Object> parameters = new HashMap<>();
  parameters.put("name", "Orders");
  parameters.put("provider", "snowflake");
  parameters.put("config", {"account_identifier" => "value", "database_name" => "value", "schema_name" => "value", "table_name" => "value"});
  parameters.put("secret_id", 1);
  
  DatabaseDestination databaseDestination = DatabaseDestination.create(parameters);
  // Operate on databaseDestination
} catch (NotAuthenticatedException e) {
  System.out.println("Authentication Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
} catch (SdkException e) {
  System.out.println("Unknown Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
}

Update Database Destination

SDK Function

databaseDestination.update();

Return Object

DatabaseDestination

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

Attribute Setters

SetterDescription
setName
string
Name of the destination.
setSecretId
int64
ID of a Secret in the same Workspace. Use a Token Secret for Snowflake, a service account Key/Value Secret for BigQuery, or a Username/Password Secret for a database login.
setConfig
object
Provider settings for the destination. Use the schema matching provider. The connection address and table are fixed after creation.

Example Request

import com.files.exceptions.*;
import com.files.exceptions.ApiErrorException.*;
import com.files.models.DatabaseDestination;

try {
  // Find the databaseDestination object by its id.
  DatabaseDestination databaseDestination = DatabaseDestination.find(id, null);
  HashMap<String, Object> parameters = new HashMap<>();
  parameters.put("name", "Orders");
  databaseDestination.update(parameters);
} catch (NotAuthenticatedException e) {
  System.out.println("Authentication Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
} catch (SdkException e) {
  System.out.println("Unknown Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
}

Delete Database Destination

SDK Function

databaseDestination.delete();

Return Object

No return value.

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

Example Request

import com.files.exceptions.*;
import com.files.exceptions.ApiErrorException.*;
import com.files.models.DatabaseDestination;

try {
  // Find the databaseDestination object by its id.
  DatabaseDestination databaseDestination = DatabaseDestination.find(id, null);
  databaseDestination.delete(null);
} catch (NotAuthenticatedException e) {
  System.out.println("Authentication Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
} catch (SdkException e) {
  System.out.println("Unknown Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
}

The DatabaseDestination Object

Some of the functions above return a DatabaseDestination object. The attributes of this object are listed below.

AttributeDescription
id
int64
Database Destination ID.
workspace_id
int64
Workspace ID. 0 means the default workspace.
name
string
Name of the destination.
provider
string
Database provider.
Possible values: snowflake, bigquery, supabase, postgresql, mysql
config
object
Provider settings for the destination. Use the schema matching provider. The connection address and table are fixed after creation.
secret_id
int64
ID of a Secret in the same Workspace. Use a Token Secret for Snowflake, a service account Key/Value Secret for BigQuery, or a Username/Password Secret for a database login.
created_at
date-time
When the destination was created.
updated_at
date-time
When the destination was last updated.

config

Value typeDescription
object