Details
-
Task
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
None
-
None
-
2024-1
Description
cpimport is not able to load BLOB values. No data gets loaded into BLOB column and the value is left NULL.
Repro
------
1. create schema
CREATE TABLE `lte_call_leg_by_mesh_2_IMSI` ( `MeshID` bigint(20) DEFAULT NULL, `IMSI` blob DEFAULT NULL ) ENGINE=Columnstore DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
2. create text data and import
cat data.csv
1111111,oneoneoneoneoneoneoneone
cpimport -s ',' test lte_call_leg_by_mesh_2_IMSI data.csv
MariaDB [test]> select * from lte_call_leg_by_mesh_2_IMSI;
-------------+
MeshID | IMSI |
-------------+
1111111 | NULL |
-------------+
1 rows in set (0.030 sec)
convert the above csv file into a binary file data.bin as follows,
3. create binary data and import
python program to create binary file for the above data.csv file>
import csv
with open('data.csv', 'r') as csvfile, open('data.bin', 'wb') as binfile:
reader = csv.reader(csvfile)
for row in reader:
binfile.write(bytes(','.join(row), 'utf-8'))
cpimport -s ',' test lte_call_leg_by_mesh_2_IMSI data.bin
MariaDB [test]> select * from lte_call_leg_by_mesh_2_IMSI;
-------------+
MeshID | IMSI |
-------------+
1111111 | NULL |
1111111 | NULL |
-------------+
2 rows in set (0.034 sec)