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

質問編集履歴

1

回答を受けて修正

2018/07/28 09:32

投稿

RenNearco
RenNearco

スコア13

title CHANGED
File without changes
body CHANGED
@@ -5,11 +5,33 @@
5
5
  ### 発生している問題・エラーメッセージ
6
6
  ```
7
7
  Traceback (most recent call last):
8
+ 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
9
+ md_query
10
+ raw_as_string=raw_as_string)
11
+ _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
12
+ use near 'values (742976, ディープインパクト, Deep Impact, JPN, 繁殖, サラ, ' at line 1
13
+
14
+ During handling of the above exception, another exception occurred:
15
+
16
+ Traceback (most recent call last):
8
- File "horse.py", line 90, in <module>
17
+ File "horse_q.py", line 76, in <module>
9
18
  profile['市場取引'], profile['繋養先'], profile['種付料']))
19
+ 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
20
+ te
10
- TypeError: 'str' object is not callable
21
+ raw_as_string=self._raw_as_string)
22
+ 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
23
+ md_query
24
+ sqlstate=exc.sqlstate)
25
+ 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
26
+ e right syntax to use near 'values (742976, ディープインパクト, Deep Impact, JPN, 繁殖, サラ, ' at line 1
11
27
  ```
12
28
 
29
+
30
+ ### 修正
31
+ **以下のように%をつけました。
32
+ 単純にSQLが間違っているのでしょうか。**
33
+
34
+
13
35
  ### 該当のソースコード
14
36
  未完ですが、以下ソースコードです。
15
37
  ```python
@@ -82,7 +104,7 @@
82
104
  state, kind, sex, date_of_birth, owner, coat_color, \
83
105
  trainer, breeding_farm, producting_area, past_performance, earning, \
84
106
  market, maintin_farm, stud_fee \
85
- values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)'
107
+ values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)' %
86
108
  (start, name_ja, name_en, country,
87
109
  profile['登録'], profile['品種'], profile['性別'],
88
110
  profile['生年月日'], profile['馬主'], profile['毛色'],