質問編集履歴

1

回答を受けて修正

2018/07/28 09:32

投稿

RenNearco
RenNearco

スコア13

test CHANGED
File without changes
test CHANGED
@@ -12,16 +12,60 @@
12
12
 
13
13
  Traceback (most recent call last):
14
14
 
15
+ File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/mysql/connector/connection_cext.py", line 377, in c
16
+
17
+ md_query
18
+
19
+ raw_as_string=raw_as_string)
20
+
21
+ _mysql_connector.MySQLInterfaceError: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to
22
+
23
+ use near 'values (742976, ディープインパクト, Deep Impact, JPN, 繁殖, サラ, ' at line 1
24
+
25
+
26
+
27
+ During handling of the above exception, another exception occurred:
28
+
29
+
30
+
31
+ Traceback (most recent call last):
32
+
15
- File "horse.py", line 90, in <module>
33
+ File "horse_q.py", line 76, in <module>
16
34
 
17
35
  profile['市場取引'], profile['繋養先'], profile['種付料']))
18
36
 
37
+ File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/mysql/connector/cursor_cext.py", line 264, in execu
38
+
39
+ te
40
+
19
- TypeError: 'str' object is not callable
41
+ raw_as_string=self._raw_as_string)
42
+
43
+ File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/mysql/connector/connection_cext.py", line 380, in c
44
+
45
+ md_query
46
+
47
+ sqlstate=exc.sqlstate)
48
+
49
+ mysql.connector.errors.ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for th
50
+
51
+ e right syntax to use near 'values (742976, ディープインパクト, Deep Impact, JPN, 繁殖, サラ, ' at line 1
20
52
 
21
53
  ```
22
54
 
23
55
 
24
56
 
57
+
58
+
59
+ ### 修正
60
+
61
+ **以下のように%をつけました。
62
+
63
+ 単純にSQLが間違っているのでしょうか。**
64
+
65
+
66
+
67
+
68
+
25
69
  ### 該当のソースコード
26
70
 
27
71
  未完ですが、以下ソースコードです。
@@ -166,7 +210,7 @@
166
210
 
167
211
  market, maintin_farm, stud_fee \
168
212
 
169
- values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)'
213
+ values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)' %
170
214
 
171
215
  (start, name_ja, name_en, country,
172
216