Skip to contents

Get or set global sx options

Usage

sx_options(
  output_type = NULL,
  verbosity = NULL,
  threads = NULL,
  memory_limit_gb = NULL,
  duckdb_threads = NULL,
  duckdb_memory_limit_gb = NULL,
  duckdb_enforcement_mode = NULL
)

Arguments

output_type

Character string. Controls the default return type for spatial operations. Must be one of:

  • sedonadb_dataframe (default): Lazy data frame (no collection).

  • sf: Materialized sf object.

  • tibble: Tibble without geometry.

  • geoarrow: Tibble with geoarrow_vctr geometry (Arrow-native).

  • raw: Tibble with geometry as raw WKB bytes (for database import).

If NULL (the default), the existing option is not changed.

verbosity

Character or NULL. Controls message output level:

  • "quiet": Suppress all informational messages.

  • "info" (default): Show standard progress and status messages.

  • "debug": Show additional diagnostic messages for troubleshooting.

threads

Positive integer. Number of threads to use for SedonaDB parallel operations.

memory_limit_gb

Positive numeric. Memory limit in GB for SedonaDB backend operations. Note: For SedonaDB/DataFusion, this setting is applied at the runtime level and may not be visible via SQL SHOW ALL.

duckdb_threads

Positive integer or "Auto". Threads for DuckDB operations.

duckdb_memory_limit_gb

Positive numeric or "Auto". Memory limit for DuckDB (e.g., 4 or "4GB").

duckdb_enforcement_mode

Character. Controls resource limit enforcement scope:

  • "internal" (default): Limits apply only to internal sx connections.

  • "all": Limits apply to all observable DuckDB connections.

Note on Policy Immunity: Connections manually configured via sx_limit_duckdb_conn() (with explicit limits) are "pinned" in an internal registry. Pinned connections are immune to global policy enforcement, ensuring that manual engineering decisions are respected.

If NULL (the default), the existing option is not changed.

Value

Invisibly returns a list containing the currently set options when setting. Returns the list visibly when called without arguments (getter mode).

Examples

if (FALSE) { # \dontrun{
# --- Output Type Options ---
# Set default output to sf (materialized)
sx_options(output_type = "sf")

# --- Independent Resource Config ---
sx_options(
  threads = 8,                 # SedonaDB (Heavy compute)
  duckdb_threads = 2,          # DuckDB (I/O only)
  duckdb_memory_limit_gb = 4   # DuckDB specific limit
)

# --- View Current Configuration ---
sx_options()
} # }