Skip to main content
The DWH sub-client provides access to the IYREE Data Warehouse powered by StarRocks. Execute SQL queries and bulk-insert data via Stream Load.

sql

Execute a SQL query against StarRocks. Uses the StarRocks SQL HTTP API under the hood. The response is streamed as NDJSON and parsed incrementally.
Only SELECT, SHOW, EXPLAIN, and KILL statements are supported. DDL and DML statements (e.g. CREATE, INSERT, UPDATE, DELETE) are not allowed.

Parameters

str
required
SQL query string to execute.
Dict[str, Any]
Optional StarRocks session variables applied for this query.

Returns DwhQueryResult

List[ColumnMeta]
Column metadata from the query result.
List[List[Any]]
Data rows. Each row is a list of values in column order.
Dict[str, Any]
Query execution statistics from StarRocks.
int
Connection identifier from StarRocks.

Result methods

() -> List[Dict[str, Any]]
Convert rows to a list of {column_name: value} dictionaries.
() -> pd.DataFrame
Convert to a pandas DataFrame. Requires iyree[pandas].

Errors

Examples


raw_sql

Execute any SQL statement against StarRocks via the streaming /rawSql endpoint. Unlike sql(), this method supports all SQL statement types — including INSERT INTO ... SELECT, CREATE, ALTER, DROP, DELETE, and more.
Use raw_sql() for DML/DDL operations that sql() does not support. For SELECT queries, prefer sql() — it returns richer metadata (column types, statistics, connection ID). For inserting data directly (from your application), prefer insert() which uses the optimized Stream Load path.
Common use cases:
  • INSERT INTO ... SELECT — transform and load data between tables
  • INSERT INTO ... SELECT * FROM FILES(...) — load data from external files
  • DELETE FROM — delete rows by condition
  • CREATE TABLE, ALTER TABLE, DROP TABLE — DDL operations

Parameters

str
required
SQL statement to execute. Any valid StarRocks SQL is accepted.

Returns DwhRawSqlResult

The result adapts to the statement type. For SELECT-like statements, columns and rows are populated. For DML/DDL, affected_rows is populated instead.
List[str]
Column names from the result. Empty for DML/DDL statements.
List[Dict[str, Any]]
Data rows as dictionaries ({column_name: value}). Empty for DML/DDL statements.
int
default:"0"
Number of rows returned (for SELECT-like statements). 0 for DML/DDL.
int
default:"0"
Number of rows affected (for DML/DDL statements). 0 for SELECT.

Result methods

() -> List[Dict[str, Any]]
Return rows as a list of {column_name: value} dicts. Since rows are already stored as dicts, this is an identity operation.
() -> pd.DataFrame
Convert to a pandas DataFrame. Requires iyree[pandas].

Errors

Examples


insert

Insert data into a StarRocks table via Stream Load. Supports CSV strings, raw bytes, JSON lists, and pandas DataFrames.

Parameters

str
required
Target table name in StarRocks.
str | bytes | List[dict] | pd.DataFrame
required
Payload to insert. The SDK auto-detects the type and adjusts the format accordingly:
  • str — encoded as UTF-8, sent as-is
  • bytes — sent as-is
  • List[dict] — serialized to JSON, format switched to json, strip_outer_array enabled
  • pd.DataFrame — exported to CSV (headerless), column names extracted automatically
str
default:"\"csv\""
Data format: "csv" or "json". Automatically overridden to "json" when data is a list.
str
Idempotency label. When provided, re-sending the same label is safe — StarRocks deduplicates.
List[str]
Column mapping for CSV data. Automatically populated from DataFrame column names when inserting a DataFrame.
str
default:"\",\""
Column separator for CSV format.
float
Request timeout override in seconds. Defaults to stream_load_timeout from configuration.
str
Extra StarRocks Stream Load headers passed as keyword arguments (e.g. max_filter_ratio="0.1").

Returns StreamLoadResult

int
StarRocks transaction ID.
str
Label used for the load operation.
str
Operation status: Success, Fail, Publish Timeout, Label Already Exists, etc.
str
Human-readable status message.
int
Total rows processed.
int
Rows successfully loaded.
int
Rows filtered out.
int
Rows not selected.
int
Bytes loaded.
int
Load duration in milliseconds.
str
URL to fetch detailed error info when rows are filtered. None if no errors.

Errors

Examples