Arcadic.Import (Arcadic v0.4.0)

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 is value-free (never echoes the offending URL / name / value — AGENTS.md Rule 3).

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.

For an incremental (create → bulk-load → index) load, order it yourself: create the type, load the rows (a command/4 loop or a transaction/3), then create the index — a LSM_TREE or dense LSM_VECTOR index retro-indexes existing rows, but a LSM_SPARSE_VECTOR index must be created BEFORE the load (it does not retro-index; see Arcadic.Vector). arcadic ships no index-deferral helper because the correct ordering is index-type-specific and arcadic is tenant-blind.

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()}.

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.