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",
  hostname = pal::pkg_config_val("hostname"),
  email = pal::pkg_config_val("email"),
  password = pal::pkg_config_val("password"),
  api_token = pal::pkg_config_val("api_token")
)

Arguments

connection

Subtype-specific connection details for database integrations. A list.

title

pkgsnip::type("chr") NocoDB integration title.

type

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

sub_type

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

search_paths

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

hostname

NocoDB server hostname. A character scalar.

email

E-mail address of the NocoDB user to authenticate with.

password

Password of the NocoDB user to authenticate with.

api_token

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")

} # }