Skip to contents

Adds an integration on a NocoDB server via its POST /api/v2/meta/integrations API endpoint.

Usage

create_integration(
  connection,
  title,
  type = "database",
  sub_type = c("mysql2", "pg", "sqlite3"),
  search_paths = "public",
  origin = pal::pkg_config_val("origin"),
  email = pal::pkg_config_val("email"),
  password = pal::pkg_config_val("password"),
  api_token = pal::pkg_config_val("api_token")
)

Arguments

connection

list()
Subtype-specific connection details for database integrations.

title

pkgsnip::type("chr", 1L) NocoDB integration title.

type

pkgsnip::type("chr", 1L) NocoDB integration type. One of "database", or NULL for any type.

sub_type

pkgsnip::type("chr", 1L) NocoDB integration subtype. One of "mysql2", "pg" or "sqlite3", or NULL for any subtype.

search_paths

character()
Database search paths (schemas) to expose for the "pg" integration.

origin

character(1)
NocoDB server origin.

email

character(1)
E-mail address of the NocoDB user to authenticate with.

password

character(1)
Password of the NocoDB user to authenticate with.

api_token

character(1)
NocoDB API token. Takes precedence over email and password if provided.

Value

A tibble with metadata about the newly created NocoDB integration, invisibly.

Details

Note that for the database sub-type sqlite3, NocoDB silently creates a new SQLite database upon first use if none exists under the specified filename in the connection list.

See also

Other functions to manage NocoDB integrations: delete_integration(), integration(), integration_id(), integrations(), update_integration()

Examples

if (FALSE) { # \dontrun{
# create connection to PostgreSQL DB
nocodb::create_integration(connection = list(host = "REPLACE-ME",
                                             port = 5432,
                                             ssl = TRUE,
                                             sslmode = "verify-full",
                                             user = "REPLACE-ME",
                                             password = "REPLACE-ME",
                                             database = REPLACE-ME),
                           title = "Test PGSQL",
                           type = "database",
                           sub_type = "pg")

# create connection to local SQLite DB
nocodb::create_integration(connection = list(client = "sqlite3",
                                             database = "",
                                             connection = list(filename = "/test.db"),
                                             useNullAsDefault = TRUE),
                           title = "Test SQLite",
                           type = "database",
                           sub_type = "sqlite3")

} # }