· 9 years ago · Nov 14, 2016, 12:32 AM
1/* SHELL INSTRUCTIONS */
2--transform file in b64 (change file names to your relevant file)
3
4base64 pp.pdf>pp.b64
5
6--prepare a loadfile
7rm my_load_file.txt
8
9
10-- get the content of the file
11var=$(cat pp.b64)
12
13-- put in file
14echo ""pp.b64""","""$var"" >> "my_load_file.txt"
15
16
17-- create staging table
18act -U db_superuser -w db_superuser -d beehive -c "drop table if exists public.cf_load_file;"
19act -U db_superuser -w db_superuser -d beehive -c "create dimension table public.cf_load_file(file_name varchar, content varchar);"
20
21
22-- load into staging table
23ncluster_loader -U db_superuser -w db_superuser -d beehive --csv --verbose public.cf_load_file my_load_file.txt
24
25
26-- use document parser to load the clean text (you will need to create the table beforehand)
27
28act -U db_superuser -w db_superuser -d beehive -c "INSERT INTO got_data.cf_got_text_data (file_name, content) SELECT * FROM documentParser (ON public.cf_load_file documentCol ('content') mode ('text'));"
29
30--done
31
32ERROR: function "documentparser" does not exist