Manual Ingest
Use SQL INSERT INTO for one-time addition of data to tables.
There are two ways to insert data manually:
- Insert from a query result
- Insert values directly from raw data
This feature isn't intended for ongoing ingestion. See Limitations.
For ingestion that scales with load, use Stream Ingest or Batch Ingest. Use Summary Tables for aggregations.
Before you begin⚓︎
Set up a table⚓︎
If you don't have a table configured in Hydrolix, make one. See Projects & Tables to create a table.
Configure the default transform⚓︎
The table must have a default transform configured with "is_default": true. Hydrolix uses the default transform's output_columns to discover the column schema when writing data from INSERT INTO statements. The default transform must include:
- The primary timestamp column for the table
- Every column you intend to insert data into, with matching data types
If your table already has a default transform for streaming or batch ingest, you don't need to create a separate one. To check, use either the UI or API:
- UI: Navigate to Data. Select your table and look for
(default)in the list under Table Transforms. - API: List the table's transforms and look for
"is_default": truein the transform settings.
If you need to create a default transform, see Write Transforms for details.
The following example transform defines a table with three columns: a timestamp primary column, a mycolumn1 string column, and a mycolumn2 unsigned integer column. The INSERT INTO examples on this page use this schema.
Insert data⚓︎
When inserting data, keep these things in mind:
- Insertion fails if the primary timestamp field is missing.
- The current default transform (the one marked
"is_default": true) is always used. - Manual insertion writes to the table's primary storage location. You can Specify an alternate storage location.
- No ingestion system features execute when inserting data manually. See Limitations.
Insert from a query result⚓︎
To insert from a query result, combine the INSERT INTO statement with a SELECT statement.
Hydrolix runs the SELECT query and inserts the resulting rows into myproject.mytable.
Insert values directly⚓︎
Insert data using literals in SQL statements.
You can insert multiple rows in a single statement.
If the table was empty before these insertions, it now looks like this:
The response for the INSERT INTO is a JSON object containing the bytes written, number of partitions, and rows written. Authorization credentials are omitted from the next example. See HTTP Query API for examples.
Specify an alternate storage location⚓︎
By default, INSERT INTO writes data to the table's primary storage bucket. Add the SETTINGS hdx_storage_id clause to write data to another location.
Set the storage ID to the UUID of the target storage location.
To find the UUID of a storage location, use the storage API endpoints or check the storage settings in the Hydrolix UI.
The Catalog Requires the Storage ID
The catalog must contain the storage location for each partition in the storage_id metadata field of its catalog entry.
With the SETTINGS hdx_storage_id clause, the catalog uses and records the specified value.
Without the clause, the catalog uses and records the table's default storage ID.
The SETTINGS clause works when inserting from a query result and when inserting values directly.
Limitations⚓︎
Because this feature bypasses the ingestion system, automatic data routing features don't apply to INSERT INTO statements:
- Storage mapping rules aren't evaluated.
- Shard key routing isn't applied.
- Spread list distribution isn't used.
- Summary Tables aren't created or updated.