| tenant-type | | slug | load-data-local-infile-obclient |
OBClient supports the LOAD DATA LOCAL INFILE statement, which is used to import data from a local file into a database table.
Enable the LOCAL INFILE feature
Enable the LOCAL INFILE feature by using the --local-infile option:
obclient --local-infile -h127.0.0.1 -P2881 -uroot@sys -p
or specify it explicitly:
obclient --local-infile=1 -h127.0.0.1 -P2881 -uroot@sys -p
Usage example
Prepare the data file
dat.txt:1,2,3 4,5,6 7,8,9Create a table:
CREATE TABLE test(a INT, b INT, c INT);Execute the LOAD DATA LOCAL INFILE command:
LOAD DATA LOCAL INFILE '/data/dat.txt' INTO TABLE test FIELDS TERMINATED BY ',' (a, b, c);View the results:
SELECT * FROM test;The query result is as follows:
+---+---+---+ | a | b | c | +---+---+---+ | 1 | 2 | 3 | | 4 | 5 | 6 | | 7 | 8 | 9 | +---+---+---+
