Arcadic.Import (Arcadic v4.0.1)

Copy Markdown View Source

Bulk load over ArcadeDB's IMPORT DATABASE command (imports a CSV / JSON / JSONL / GraphML / Neo4j / OrientDB / ArcadeDB export into conn.database, server-side).

Tenant-blind. The source URL CANNOT be a bound parameter (ArcadeDB parse-rejects IMPORT DATABASE :url), so it is interpolated — behind a strict POSITIVE character allowlist (RFC 3986 URL characters minus the single quote and backslash) plus a scheme allowlist, which closes the SQL-string-literal injection surface by construction (ArcadeDB honors backslash- escapes inside single-quoted literals, so a mere quote-denylist would be unsound). with: import settings are developer config: names are Arcadic.Identifier-validated; number/boolean values are interpolated bare, and string values are single-quoted behind a positive ASCII charset allowlist (' / \ / control / non-ASCII excluded) — injection-inert either way. Every rejection omits the offending URL, setting name, and setting value.

Security & operational notes

ArcadeDB blocks imports from private/loopback hosts by default (importBlockLocalNetworks) → a %Arcadic.Error{reason: :unauthorized, http_status: 403, exception: "java.lang.SecurityException"}. That is DISTINCT from an auth failure (exception: "com.arcadedb.server.security.ServerSecurityException"); disambiguate on error.exception. file:// bypasses the block (server-local files).

A source URL may embed basic-auth credentials (https://user:pass@host/…). The success row's fromUrl and a failed import's error.detail (quarantined from message/1/inspect/1 but reachable) may echo it — do not embed credentials in the URL, or redact before logging.

See Load data for the order of type creation, data load, and index creation.

Summary

Functions

Imports url into conn.database via IMPORT DATABASE '<url>'[ WITH …]. Returns {:ok, rows} (rows carry operation/fromUrl/parsedRecords/result) or {:error, Arcadic.Error.t() | Arcadic.TransportError.t()}.

Imports url, returning the rows or raising.

Functions

database(conn, url, opts \\ [])

@spec database(Arcadic.Conn.t(), String.t(), keyword()) ::
  {:ok, [map()]} | {:error, Exception.t()}

Imports url into conn.database via IMPORT DATABASE '<url>'[ WITH …]. Returns {:ok, rows} (rows carry operation/fromUrl/parsedRecords/result) or {:error, Arcadic.Error.t() | Arcadic.TransportError.t()}.

When a 2xx response contains a result row with "result" => "FAIL", returns {:error, %Arcadic.Error{reason: :import_failed}}. The raw diagnostic stays in the error's detail field and is omitted from the exception message.

opts: with — a keyword list of import settings whose values are numbers, booleans, or allowlisted strings (e.g. with: [commitEvery: 100, wal: false, mapping: "map.json"]).

Raises ArgumentError (value-free, before any request) on an invalid URL or with: entry.

database!(conn, url, opts \\ [])

@spec database!(Arcadic.Conn.t(), String.t(), keyword()) :: [map()]

Imports url, returning the rows or raising.