Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #42079 > unrolled thread
| Started by | Νίκος Γκρ33κ <nikos.gr33k@gmail.com> |
|---|---|
| First post | 2013-03-27 20:50 -0700 |
| Last post | 2013-03-29 12:24 -0700 |
| Articles | 20 on this page of 26 — 5 participants |
Back to article view | Back to comp.lang.python
Cannot run a single MySQLdb execute.... Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-27 20:50 -0700
Re: Cannot run a single MySQLdb execute.... Chris Angelico <rosuav@gmail.com> - 2013-03-28 15:00 +1100
Re: Cannot run a single MySQLdb execute.... Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-27 21:03 -0700
Re: Cannot run a single MySQLdb execute.... Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-27 21:08 -0700
Re: Cannot run a single MySQLdb execute.... Chris Angelico <rosuav@gmail.com> - 2013-03-28 15:14 +1100
Re: Cannot run a single MySQLdb execute.... Chris Angelico <rosuav@gmail.com> - 2013-03-28 15:08 +1100
Re: Cannot run a single MySQLdb execute.... Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-27 21:18 -0700
Re: Cannot run a single MySQLdb execute.... Chris Angelico <rosuav@gmail.com> - 2013-03-28 15:26 +1100
Re: Cannot run a single MySQLdb execute.... Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-27 21:30 -0700
Re: Cannot run a single MySQLdb execute.... Chris Angelico <rosuav@gmail.com> - 2013-03-28 15:35 +1100
Re: Cannot run a single MySQLdb execute.... Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-27 21:39 -0700
Re: Cannot run a single MySQLdb execute.... Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-27 21:39 -0700
Re: Cannot run a single MySQLdb execute.... Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-27 21:30 -0700
Re: Cannot run a single MySQLdb execute.... Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-27 21:18 -0700
Re: Cannot run a single MySQLdb execute.... Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-27 21:08 -0700
Re: Cannot run a single MySQLdb execute.... Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-28 02:44 -0700
Re: Cannot run a single MySQLdb execute.... Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-28 02:44 -0700
Re: Cannot run a single MySQLdb execute.... David M Chess <chess@us.ibm.com> - 2013-03-28 10:51 -0400
Re: Cannot run a single MySQLdb execute.... Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-28 12:35 -0700
Re: Cannot run a single MySQLdb execute.... Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-28 12:35 -0700
Re: Cannot run a single MySQLdb execute.... Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-27 21:03 -0700
Re: Cannot run a single MySQLdb execute.... Alan Meyer <ameyer2@yahoo.com> - 2013-03-28 16:54 -0400
Re: Cannot run a single MySQLdb execute.... Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-29 00:40 -0700
Re: Cannot run a single MySQLdb execute.... Alan Meyer <ameyer2@yahoo.com> - 2013-03-29 13:32 -0400
Re: Cannot run a single MySQLdb execute.... Alan Meyer <ameyer2@yahoo.com> - 2013-03-29 13:39 -0400
Re: Cannot run a single MySQLdb execute.... nagia.retsina@gmail.com - 2013-03-29 12:24 -0700
Page 1 of 2 [1] 2 Next page →
| From | Νίκος Γκρ33κ <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2013-03-27 20:50 -0700 |
| Subject | Cannot run a single MySQLdb execute.... |
| Message-ID | <c0c16d2d-b4b2-4d7a-8f1e-606ee2030ad9@googlegroups.com> |
I'am about to go nuts with python 3.2.3 Do you see somehtign wrong with the following statement? cur.execute( '''SELECT hits FROM counters WHERE url = ?''', (page,) ) data = cur.fetchone() because as you can see by visiting my webpage at http://superhost.gr it produces an error and i dont have aclue why. Please help. i'am using MySQLdb
[toc] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-03-28 15:00 +1100 |
| Subject | Re: Cannot run a single MySQLdb execute.... |
| Message-ID | <mailman.3849.1364443225.2939.python-list@python.org> |
| In reply to | #42079 |
On Thu, Mar 28, 2013 at 2:50 PM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote: > I'am about to go nuts with python 3.2.3 > > Do you see somehtign wrong with the following statement? > > cur.execute( '''SELECT hits FROM counters WHERE url = ?''', (page,) ) > data = cur.fetchone() > > because as you can see by visiting my webpage at http://superhost.gr it produces an error and i dont have aclue why. > > Please help. i'am using MySQLdb Is this the docs for the module you're using? http://mysql-python.sourceforge.net/MySQLdb.html """ paramstyle String constant stating the type of parameter marker formatting expected by the interface. Set to 'format' = ANSI C printf format codes, e.g. '...WHERE name=%s'. If a mapping object is used for conn.execute(), then the interface actually uses 'pyformat' = Python extended format codes, e.g. '...WHERE name=%(name)s'. However, the API does not presently allow the specification of more than one style in paramstyle. Note that any literal percent signs in the query string passed to execute() must be escaped, i.e. %%. Parameter placeholders can only be used to insert column values. They can not be used for other parts of SQL, such as table names, statements, etc. """ What paramstyle are you using? ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Νίκος Γκρ33κ <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2013-03-27 21:03 -0700 |
| Subject | Re: Cannot run a single MySQLdb execute.... |
| Message-ID | <2ac959c6-d169-452f-b622-83fe25fbd8da@googlegroups.com> |
| In reply to | #42083 |
Τη Πέμπτη, 28 Μαρτίου 2013 6:00:17 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: > What paramstyle are you using? Yes it is Chris, but i'am not sure what exactly are you asking me. Please if you cna pout it even simper for me, thank you.
[toc] | [prev] | [next] | [standalone]
| From | Νίκος Γκρ33κ <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2013-03-27 21:08 -0700 |
| Subject | Re: Cannot run a single MySQLdb execute.... |
| Message-ID | <27d81c51-92cc-40bf-b9c3-701c19fca282@googlegroups.com> |
| In reply to | #42084 |
If you mean if iam using '?' or this '%s' the latter used to work flawlessly with python 2.6 but it does not in pythin 3.2.3 both this command fail in python 3.x cur.execute( '''SELECT hits FROM counters WHERE url = ?''', (page,) ) cur.execute( '''SELECT hits FROM counters WHERE url = %s''', (page,) ) i dont have a clue why....
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-03-28 15:14 +1100 |
| Subject | Re: Cannot run a single MySQLdb execute.... |
| Message-ID | <mailman.3852.1364444087.2939.python-list@python.org> |
| In reply to | #42085 |
On Thu, Mar 28, 2013 at 3:08 PM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote: > If you mean if iam using '?' or this '%s' the latter used to work flawlessly with python 2.6 but it does not in pythin 3.2.3 Print out the value of that attribute. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-03-28 15:08 +1100 |
| Subject | Re: Cannot run a single MySQLdb execute.... |
| Message-ID | <mailman.3850.1364443717.2939.python-list@python.org> |
| In reply to | #42084 |
On Thu, Mar 28, 2013 at 3:03 PM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote: > Τη Πέμπτη, 28 Μαρτίου 2013 6:00:17 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: > >> What paramstyle are you using? > > Yes it is Chris, but i'am not sure what exactly are you asking me. > Please if you cna pout it even simper for me, thank you. As it says in that document, paramstyle is a top-level module attribute. Try printing it out. See what it says. Then match your code to it. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Νίκος Γκρ33κ <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2013-03-27 21:18 -0700 |
| Subject | Re: Cannot run a single MySQLdb execute.... |
| Message-ID | <19fcf06e-8923-410c-9acd-abd4534c77bf@googlegroups.com> |
| In reply to | #42086 |
Τη Πέμπτη, 28 Μαρτίου 2013 6:08:28 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: > As it says in that document, paramstyle is a top-level module > attribute. Try printing it out. See what it says. Then match your code sql = '''SELECT hits FROM counters WHERE url = %s''' % page print( sql ) cur.execute( sql ) Now the error says: _mysql_exceptions.OperationalError: (1054, "Unknown column 'index.html' in 'where clause'") as you cna see at my webpage
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-03-28 15:26 +1100 |
| Subject | Re: Cannot run a single MySQLdb execute.... |
| Message-ID | <mailman.3854.1364444811.2939.python-list@python.org> |
| In reply to | #42089 |
On Thu, Mar 28, 2013 at 3:18 PM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote: > Τη Πέμπτη, 28 Μαρτίου 2013 6:08:28 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: > >> As it says in that document, paramstyle is a top-level module >> attribute. Try printing it out. See what it says. Then match your code > > sql = '''SELECT hits FROM counters WHERE url = %s''' % page > print( sql ) > cur.execute( sql ) > > Now the error says: > > _mysql_exceptions.OperationalError: (1054, "Unknown column 'index.html' in 'where clause'") as you cna see at my webpage http://www.facepalm.de/ Do you understand SQL injection attacks and the concept of parameterized queries? ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Νίκος Γκρ33κ <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2013-03-27 21:30 -0700 |
| Subject | Re: Cannot run a single MySQLdb execute.... |
| Message-ID | <aef90a2f-3e2e-4f78-901c-58f3ad035ec1@googlegroups.com> |
| In reply to | #42091 |
Τη Πέμπτη, 28 Μαρτίου 2013 6:26:48 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: > On Thu, Mar 28, 2013 at 3:18 PM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote: > > > Τη Πέμπτη, 28 Μαρτίου 2013 6:08:28 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: > > > > > >> As it says in that document, paramstyle is a top-level module > > >> attribute. Try printing it out. See what it says. Then match your code > > > > > > sql = '''SELECT hits FROM counters WHERE url = %s''' % page > > > print( sql ) > > > cur.execute( sql ) > > > > > > Now the error says: > > > > > > _mysql_exceptions.OperationalError: (1054, "Unknown column 'index.html' in 'where clause'") as you cna see at my webpage > > > > http://www.facepalm.de/ > > > > Do you understand SQL injection attacks and the concept of > > parameterized queries? > > > > ChrisA Yes i know i'am not supposed to use "%s" and i dotn want to but you asked me to print the sql statemnt before executing it. please its 6:30am here in greece and didnt had any sleep yet. please tell me whats wrong....
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-03-28 15:35 +1100 |
| Subject | Re: Cannot run a single MySQLdb execute.... |
| Message-ID | <mailman.3856.1364445317.2939.python-list@python.org> |
| In reply to | #42092 |
On Thu, Mar 28, 2013 at 3:30 PM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote: > Τη Πέμπτη, 28 Μαρτίου 2013 6:26:48 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: >> On Thu, Mar 28, 2013 at 3:18 PM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote: >> >> > Τη Πέμπτη, 28 Μαρτίου 2013 6:08:28 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: >> >> > >> >> >> As it says in that document, paramstyle is a top-level module >> >> >> attribute. Try printing it out. See what it says. Then match your code >> >> > >> >> > sql = '''SELECT hits FROM counters WHERE url = %s''' % page >> >> > print( sql ) >> >> > cur.execute( sql ) >> >> > >> >> > Now the error says: >> >> > >> >> > _mysql_exceptions.OperationalError: (1054, "Unknown column 'index.html' in 'where clause'") as you cna see at my webpage >> >> >> >> http://www.facepalm.de/ >> >> >> >> Do you understand SQL injection attacks and the concept of >> >> parameterized queries? >> >> >> >> ChrisA > > Yes i know i'am not supposed to use "%s" and i dotn want to but you asked me to print the sql statemnt before executing it. > > please its 6:30am here in greece and didnt had any sleep yet. > please tell me whats wrong.... No. I said to print out the paramstyle attribute. If it's that late and you haven't slept, get some sleep, then reread this thread. You may be able to respond more intelligently. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Νίκος Γκρ33κ <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2013-03-27 21:39 -0700 |
| Subject | Re: Cannot run a single MySQLdb execute.... |
| Message-ID | <28519666-ebd4-485e-b409-3260f2da379d@googlegroups.com> |
| In reply to | #42094 |
Τη Πέμπτη, 28 Μαρτίου 2013 6:35:14 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: > No. I said to print out the paramstyle attribute. If it's that late > > and you haven't slept, get some sleep, then reread this thread. You > > may be able to respond more intelligently. What is a paramstyle attribute? Tell me what exactly it is in simple words and i;ll print it for you. I can't get any sleep because ia'am too tense with this issue.
[toc] | [prev] | [next] | [standalone]
| From | Νίκος Γκρ33κ <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2013-03-27 21:39 -0700 |
| Subject | Re: Cannot run a single MySQLdb execute.... |
| Message-ID | <mailman.3858.1364445590.2939.python-list@python.org> |
| In reply to | #42094 |
Τη Πέμπτη, 28 Μαρτίου 2013 6:35:14 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: > No. I said to print out the paramstyle attribute. If it's that late > > and you haven't slept, get some sleep, then reread this thread. You > > may be able to respond more intelligently. What is a paramstyle attribute? Tell me what exactly it is in simple words and i;ll print it for you. I can't get any sleep because ia'am too tense with this issue.
[toc] | [prev] | [next] | [standalone]
| From | Νίκος Γκρ33κ <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2013-03-27 21:30 -0700 |
| Subject | Re: Cannot run a single MySQLdb execute.... |
| Message-ID | <mailman.3855.1364445053.2939.python-list@python.org> |
| In reply to | #42091 |
Τη Πέμπτη, 28 Μαρτίου 2013 6:26:48 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: > On Thu, Mar 28, 2013 at 3:18 PM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote: > > > Τη Πέμπτη, 28 Μαρτίου 2013 6:08:28 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: > > > > > >> As it says in that document, paramstyle is a top-level module > > >> attribute. Try printing it out. See what it says. Then match your code > > > > > > sql = '''SELECT hits FROM counters WHERE url = %s''' % page > > > print( sql ) > > > cur.execute( sql ) > > > > > > Now the error says: > > > > > > _mysql_exceptions.OperationalError: (1054, "Unknown column 'index.html' in 'where clause'") as you cna see at my webpage > > > > http://www.facepalm.de/ > > > > Do you understand SQL injection attacks and the concept of > > parameterized queries? > > > > ChrisA Yes i know i'am not supposed to use "%s" and i dotn want to but you asked me to print the sql statemnt before executing it. please its 6:30am here in greece and didnt had any sleep yet. please tell me whats wrong....
[toc] | [prev] | [next] | [standalone]
| From | Νίκος Γκρ33κ <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2013-03-27 21:18 -0700 |
| Subject | Re: Cannot run a single MySQLdb execute.... |
| Message-ID | <mailman.3853.1364444320.2939.python-list@python.org> |
| In reply to | #42086 |
Τη Πέμπτη, 28 Μαρτίου 2013 6:08:28 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: > As it says in that document, paramstyle is a top-level module > attribute. Try printing it out. See what it says. Then match your code sql = '''SELECT hits FROM counters WHERE url = %s''' % page print( sql ) cur.execute( sql ) Now the error says: _mysql_exceptions.OperationalError: (1054, "Unknown column 'index.html' in 'where clause'") as you cna see at my webpage
[toc] | [prev] | [next] | [standalone]
| From | Νίκος Γκρ33κ <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2013-03-27 21:08 -0700 |
| Subject | Re: Cannot run a single MySQLdb execute.... |
| Message-ID | <mailman.3859.1364446314.2939.python-list@python.org> |
| In reply to | #42084 |
If you mean if iam using '?' or this '%s' the latter used to work flawlessly with python 2.6 but it does not in pythin 3.2.3 both this command fail in python 3.x cur.execute( '''SELECT hits FROM counters WHERE url = ?''', (page,) ) cur.execute( '''SELECT hits FROM counters WHERE url = %s''', (page,) ) i dont have a clue why....
[toc] | [prev] | [next] | [standalone]
| From | Νίκος Γκρ33κ <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2013-03-28 02:44 -0700 |
| Subject | Re: Cannot run a single MySQLdb execute.... |
| Message-ID | <c52869dc-7d48-4bcb-b95a-ccb1143d57fb@googlegroups.com> |
| In reply to | #42098 |
Can someone else esxcept Chris help me please? I'm strugling with this and cannot see whats wrong.
[toc] | [prev] | [next] | [standalone]
| From | Νίκος Γκρ33κ <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2013-03-28 02:44 -0700 |
| Subject | Re: Cannot run a single MySQLdb execute.... |
| Message-ID | <mailman.3867.1364466274.2939.python-list@python.org> |
| In reply to | #42098 |
Can someone else esxcept Chris help me please? I'm strugling with this and cannot see whats wrong.
[toc] | [prev] | [next] | [standalone]
| From | David M Chess <chess@us.ibm.com> |
|---|---|
| Date | 2013-03-28 10:51 -0400 |
| Subject | Re: Cannot run a single MySQLdb execute.... |
| Message-ID | <mailman.3881.1364482903.2939.python-list@python.org> |
| In reply to | #42084 |
[Multipart message — attachments visible in raw view] — view raw
Νίκος Γκρ33κ <nikos.gr33k@gmail.com> : >> What paramstyle are you using? > >Yes it is Chris, but i'am not sure what exactly are you asking me. >Please if you cna pout it even simper for me, thank you. For instance: >>> import MySQLdb >>> MySQLdb.paramstyle 'format' FWIW and HTH, DC
[toc] | [prev] | [next] | [standalone]
| From | Νίκος Γκρ33κ <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2013-03-28 12:35 -0700 |
| Subject | Re: Cannot run a single MySQLdb execute.... |
| Message-ID | <0bcd5977-5275-4812-8922-79d656fc4eed@googlegroups.com> |
| In reply to | #42139 |
Τη Πέμπτη, 28 Μαρτίου 2013 4:51:16 μ.μ. UTC+2, ο χρήστης David M Chess έγραψε: > Νίκος Γκρ33κ <nikos...@gmail.com> > : > > > > >> What paramstyle are you using? > > > > > >Yes it is Chris, but i'am not sure what exactly are you asking me. > > >Please if you cna pout it even simper for me, thank you. > > > > For instance: > > > > >>> import MySQLdb > > >>> MySQLdb.paramstyle > > 'format' > > nikos@superhost.gr [~]# /usr/bin/python3 Python 3.2.3 (default, May 23 2012, 18:47:48) [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import MySQLdb >>> MySQLdb.paramstyle 'format' >>>
[toc] | [prev] | [next] | [standalone]
| From | Νίκος Γκρ33κ <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2013-03-28 12:35 -0700 |
| Subject | Re: Cannot run a single MySQLdb execute.... |
| Message-ID | <mailman.3911.1364502084.2939.python-list@python.org> |
| In reply to | #42139 |
Τη Πέμπτη, 28 Μαρτίου 2013 4:51:16 μ.μ. UTC+2, ο χρήστης David M Chess έγραψε: > Νίκος Γκρ33κ <nikos...@gmail.com> > : > > > > >> What paramstyle are you using? > > > > > >Yes it is Chris, but i'am not sure what exactly are you asking me. > > >Please if you cna pout it even simper for me, thank you. > > > > For instance: > > > > >>> import MySQLdb > > >>> MySQLdb.paramstyle > > 'format' > > nikos@superhost.gr [~]# /usr/bin/python3 Python 3.2.3 (default, May 23 2012, 18:47:48) [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import MySQLdb >>> MySQLdb.paramstyle 'format' >>>
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.lang.python
csiph-web