teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

追加情報

2019/11/05 04:35

投稿

cali
cali

スコア4

title CHANGED
File without changes
body CHANGED
@@ -74,4 +74,21 @@
74
74
  | e | int(11) | YES | | NULL | |
75
75
  | f | int(11) | YES | | NULL | |
76
76
  | g | text | YES | UNI | NULL | |
77
- +---------+--------------+------+-----+---------+----------------+
77
+ +---------+--------------+------+-----+---------+----------------+
78
+
79
+ ### 追記
80
+ 以下、insert文で実行すると問題なくDBへのinsertが行われています。
81
+ INSERT ~ ON DUPLICATE KEY UPDATE文でエラーを起こしているとは思うのですが、、、
82
+ わかりません。。
83
+ ```python
84
+ sql_insert = 'insert into test values(%(a)s, %(b)s, %(c)s, %(d)s, %(e)s, %(f)s, %(g)s'
85
+ cur.execute(sql_insert,{
86
+ 'a':content['a'],
87
+ 'b':content['b'],
88
+ 'c':content['c'],
89
+ 'd':content['d'],
90
+ 'e':content['e'],
91
+ 'f':content['f'],
92
+ 'g':content['g'],
93
+ })
94
+ ```