Storage
Storage
The Storage module provides functions to manage databases, tables, columns, keys, partitions, and large data operations in SCM.
← Back to Full SCM API documentation
scan
Performs an unordered parallel filter-map-reduce on a table
Allowed number of parameters: 6–10
Parameters:
- schema (
string|nil): database name - table (
string|list): table name(s) - filterColumns (
list): filter columns - filter (
func): lambda deciding dataset inclusion - mapColumns (
list): map columns - map (
func): lambda extracting/processing data - reduce (
func): optional aggregator - neutral (
any): neutral element - reduce2 (
func): optional second reducer - isOuter (
bool): outer join–like behavior
Returns: any
scan_order
Performs an ordered parallel filter with serial map-reduce
Allowed number of parameters: 10–13
Parameters:
- schema (
string): database - table (
string): table name - filterColumns (
list): filter columns - filter (
func): filter lambda - sortcols (
list): sorting columns - sortdirs (
list): sorting directions - offset (
number): skip count - limit (
number): max items - mapColumns (
list): map columns - map (
func): map lambda - reduce (
func): optional reducer - neutral (
any): neutral element - isOuter (
bool): outer behavior
Returns: any
createdatabase
Creates a new database
Allowed number of parameters: 1–2
Parameters:
- schema (
string): database name - ignoreexists (
bool): ignore if exists
Returns: bool
dropdatabase
Drops a database
Allowed number of parameters: 1–1
Parameters:
- schema (
string): database name
Returns: bool
createtable
Creates a new table
Allowed number of parameters: 4–5
Parameters:
- schema (
string): database - table (
string): table name - cols (
list): column definitions - options (
list): table options - ifnotexists (
bool): safe creation
Returns: bool
createcolumn
Creates a new column in a table
Allowed number of parameters: 6–8
Parameters:
- schema (
string): database - table (
string): table name - colname (
string): column name - type (
string): base type - dimensions (
list): type dimensions - options (
list): column options - computorCols (
list): columns for computed value - computor (
func): compute lambda
Returns: bool
createkey
Creates a new key
Allowed number of parameters: 5–5
Parameters:
- schema (
string): database - table (
string): table - keyname (
string): key name - unique (
bool): uniqueness flag - columns (
list): key columns
Returns: bool
createforeignkey
Creates a new foreign key
Allowed number of parameters: 8–8
Parameters:
- schema (
string): database - keyname (
string): key name - table1 (
string): first table - columns1 (
list): first columns - table2 (
string): second table - columns2 (
list): second columns - updatemode (
string): action on update - deletemode (
string): action on delete
Returns: bool
shardcolumn
Suggests partitions for a column
Allowed number of parameters: 3–4
Parameters:
- schema (
string): database - table (
string): table - colname (
string): column - numpartitions (
number): partitions
Returns: list
partitiontable
Applies or adjusts a partition scheme
Allowed number of parameters: 3–3
Parameters:
- schema (
string): database - table (
string): table - columns (
list): column pivots
Returns: bool
altertable
Alters a table
Allowed number of parameters: 4–4
Parameters:
- schema (
string): database - table (
string): table - operation (
string): alteration - parameter (
any): parameter
Returns: bool
altercolumn
Alters a column
Allowed number of parameters: 5–5
Parameters:
- schema (
string): database - table (
string): table - column (
string): column - operation (
string): alteration - parameter (
any): parameter
Returns: bool
droptable
Removes a table
Allowed number of parameters: 2–3
Parameters:
- schema (
string): database - table (
string): table - ifexists (
bool): safe drop
Returns: bool
insert
Inserts a dataset into a table
Allowed number of parameters: 4–7
Parameters:
- schema (
string): database - table (
string): table - columns (
list): column names - datasets (
list): row values - onCollisionCols (
list): collision columns - onCollision (
func): collision handler - mergeNull (
bool): handle null as equal
Returns: number
stat
Returns memory statistics
Allowed number of parameters: 0–2
Parameters:
- schema (
string): database (optional) - table (
string): table (optional)
Returns: string
show
Shows databases, tables, or columns
Allowed number of parameters: 0–2
Parameters:
- schema (
string): optional database - table (
string): optional table
Returns: any
rebuild
Rebuilds storages
Allowed number of parameters: 0–2
Parameters:
- all (
bool): rebuild all - repartition (
bool): repartition
Returns: string
loadCSV
Loads CSV into a table
Allowed number of parameters: 3–5
Parameters:
- schema (
string): database - table (
string): table - stream (
stream): CSV stream - delimiter (
string): delimiter - firstline (
bool): use header
Returns: string
loadJSON
Loads JSONL into a database
Allowed number of parameters: 2–2
Parameters:
- schema (
string): database - stream (
stream): JSONL stream
Returns: string
settings
Reads or writes global settings
Allowed number of parameters: 1–2
Parameters:
- key (
string): setting key - value (
any): new value
Returns: any