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 Method

files_sdk.database_destination.list()

Return Object

ListObj[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 files_sdk

try:
  database_destinations = files_sdk.database_destination.list()
  for database_destination in database_destinations.auto_paging_iter():
    print(database_destination.get_attributes())
except files_sdk.error.NotAuthenticatedError as err:
  print(f"Authentication Error Occurred ({type(err).__name__}):", err)
except files_sdk.error.Error as err:
  print(f"Unknown Error Occurred ({type(err).__name__}):", err)

Show Database Destination

SDK Method

files_sdk.database_destination.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.

Method Arguments

ArgumentDescription
id
int64
Required
Database Destination ID.

Example Request

import files_sdk

try:
  database_destination = files_sdk.database_destination.find(id)
  # Operate on database_destination
except files_sdk.error.NotAuthenticatedError as err:
  print(f"Authentication Error Occurred ({type(err).__name__}):", err)
except files_sdk.error.Error as err:
  print(f"Unknown Error Occurred ({type(err).__name__}):", err)

Create Database Destination

SDK Method

files_sdk.database_destination.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.

Method 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 files_sdk

try:
  database_destination = files_sdk.database_destination.create({
    "name": "Orders",
    "provider": "snowflake",
    "config": {"account_identifier": "value", "database_name": "value", "schema_name": "value", "table_name": "value"},
    "secret_id": 1
  })
  # Operate on database_destination
except files_sdk.error.NotAuthenticatedError as err:
  print(f"Authentication Error Occurred ({type(err).__name__}):", err)
except files_sdk.error.Error as err:
  print(f"Unknown Error Occurred ({type(err).__name__}):", err)

Update Database Destination

SDK Method

database_destination.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.

Method Arguments

ArgumentDescription
name
string
Name of the destination.
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.
config
object
Provider settings for the destination. Use the schema matching provider. The connection address and table are fixed after creation.

Example Request

import files_sdk

try:
  # Find the database_destination object by its id.
  database_destination = files_sdk.database_destination.find(id)
  database_destination.update({
    "name": "Orders"
  })
except files_sdk.error.NotAuthenticatedError as err:
  print(f"Authentication Error Occurred ({type(err).__name__}):", err)
except files_sdk.error.Error as err:
  print(f"Unknown Error Occurred ({type(err).__name__}):", err)

Delete Database Destination

SDK Method

database_destination.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 files_sdk

try:
  # Find the database_destination object by its id.
  database_destination = files_sdk.database_destination.find(id)
  database_destination.delete()
except files_sdk.error.NotAuthenticatedError as err:
  print(f"Authentication Error Occurred ({type(err).__name__}):", err)
except files_sdk.error.Error as err:
  print(f"Unknown Error Occurred ({type(err).__name__}):", err)

The DatabaseDestination Object

Some of the methods 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