Export data to bridge

Export data to bridge

Write data from the Machbase DBMS external database into the external database.

📌

For smooth practice, the following query should be run to prepare tables and data.

CREATE TAG TABLE IF NOT EXISTS EXAMPLE (
    NAME VARCHAR(20) PRIMARY KEY,
    TIME DATETIME BASETIME,
    VALUE DOUBLE SUMMARIZED
);
INSERT INTO EXAMPLE VALUES('TAG0', TO_DATE('2021-08-12'), 100);
INSERT INTO EXAMPLE VALUES('TAG0', TO_DATE('2021-08-13'), 110);

Prepare

bridge add -t sqlite mem file::memory:?cache=shared;

bridge exec mem create table if not exists mem_example(name varchar(20), time datetime, value double);

Import data from Bridge

Copy the code below into TQL editor and run

SQL("select * from example")
INSERT(bridge('mem'), table('mem_example'), 'name', 'time', 'value')

Select bridge table data

machbase-neo shell bridge query mem "select * from mem_example";

┌──────┬───────────────────────────────┬───────┐
│ NAME │ TIME                          │ VALUE │
├──────┼───────────────────────────────┼───────┤
│ TAG0 │ 2021-08-12 00:00:00 +0900 KST │    10│ TAG1 │ 2021-08-13 00:00:00 +0900 KST │    11└──────┴───────────────────────────────┴───────┘
Last updated on