回答編集履歴
2
ストア°プロシージャを追記
answer
CHANGED
@@ -82,4 +82,22 @@
|
|
82
82
|
mode: replace
|
83
83
|
# ここは入れ替えするか挿入するか等によって修正
|
84
84
|
after_load: insert into imagedst(id,image) select id,FROM_BASE64(image) from imagetemp;
|
85
|
+
```
|
86
|
+
|
87
|
+
## 2021/06/17 追記
|
88
|
+
|
89
|
+
複数SQLの件は、ストアドプロシージャーが良いように思います。
|
90
|
+
|
91
|
+
|
92
|
+
```sql
|
93
|
+
delimiter //
|
94
|
+
create PROCEDURE sync_image_table ()
|
95
|
+
begin
|
96
|
+
delete from imagedst;
|
97
|
+
insert into imagedst(id,image) select id,FROM_BASE64(image) from imagetemp;
|
98
|
+
end//
|
99
|
+
```
|
100
|
+
|
101
|
+
```yaml
|
102
|
+
after_load: call sync_image_table()
|
85
103
|
```
|
1
補足の追記
answer
CHANGED
@@ -47,4 +47,39 @@
|
|
47
47
|
* ご利用のOS
|
48
48
|
* プラグインのバージョン
|
49
49
|
* 設定ファイル(機密情報等はマスク)
|
50
|
-
* テーブル定義(サンプル等)
|
50
|
+
* テーブル定義(サンプル等)
|
51
|
+
|
52
|
+
|
53
|
+
## 2021/06/15 追記
|
54
|
+
|
55
|
+
できそうなのはこんな感じです。
|
56
|
+
|
57
|
+
```sql
|
58
|
+
create table imagetest(id int not null primary key, image MEDIUMBLOB not null);
|
59
|
+
insert into imagetest(id,image) values(1,LOAD_FILE('/path/to/image'));
|
60
|
+
create table imagedst(id int not null primary key, image MEDIUMBLOB not null);
|
61
|
+
```
|
62
|
+
|
63
|
+
```yaml
|
64
|
+
in:
|
65
|
+
type: mysql
|
66
|
+
user: user
|
67
|
+
password: password
|
68
|
+
database: embulk_test
|
69
|
+
table: imagetest
|
70
|
+
host: host
|
71
|
+
select: id,TO_BASE64(image) as image
|
72
|
+
out:
|
73
|
+
type: mysql
|
74
|
+
user: user
|
75
|
+
password: password
|
76
|
+
database: embulk_test
|
77
|
+
table: imagetemp
|
78
|
+
column_options:
|
79
|
+
image:
|
80
|
+
type: longtext
|
81
|
+
host: host
|
82
|
+
mode: replace
|
83
|
+
# ここは入れ替えするか挿入するか等によって修正
|
84
|
+
after_load: insert into imagedst(id,image) select id,FROM_BASE64(image) from imagetemp;
|
85
|
+
```
|