import

Writes all input records to the specified table. Requires cluster administrator privileges.

Command properties

PropertyValue
Command typeTransforming
Required permissionCluster administrator
License usageN/A
Parallel executionSupported
Distributed executionRuns on Control Node (reducer)

Syntax

import [create=BOOL] [_sk=STR] TABLE

Options

create=BOOL
When set to t, automatically creates the target table if it does not exist. This option is only available when the system property araqne.logdb.import_create_option is enabled. (Default: f)
_sk=STR
Field name for the partition subkey. Specifies the field from which to read the subkey value used to determine the partition when saving records. (Default: _sk)

Target

TABLE
Name of the target table to write records to.

Input fields

FieldTypeRequiredDescription
_timetimestampOptionalRecord timestamp. If the value is null or not a timestamp type, the current time is used.

Error codes

Parsing errors
Error codeMessageDescription
30100no-permissionExecuted without cluster administrator privileges
30101import-table-not-foundThe specified table does not exist and the create option was not used
30102import-table-invalidThe table name is invalid
30103create-option-is-not-supportedcreate=t was specified but the system property is disabled
Runtime errors

N/A

Description

The import command writes all input records to the specified table and passes the input records unchanged to the next command. It uses the _time field value as the storage timestamp. If the _time field is missing or not a timestamp type, the current time is used.

If the storage is in read-only mode or a write error occurs, the query is cancelled.

In a distributed environment, this command runs on the Control Node.

Examples

  1. Write records to a table

    table duration=1h web_logs | import web_logs_backup
    

    Queries the last 1 hour of data from the web_logs table and writes it to the web_logs_backup table.

  2. Save aggregated results to a table

    table duration=1d web_logs
    | stats count by method
    | import method_stats
    

    Aggregates 1 day of data from the web_logs table by HTTP method and saves it to the method_stats table.

  3. Specify the partition subkey field

    table duration=1h web_logs | import _sk=host web_logs_partitioned
    

    Uses the value of the host field as the partition subkey and writes records to the web_logs_partitioned table.