Hello,

completely new in python and sqlalchemy. My setup is win7, MySQL
5.5.16, Python 3.2.2, sqlAlchemy 0.7.4 and MySQL-python via this
website: http://www.lfd.uci.edu/~gohlke/pythonlibs/


if I run a query like this:

for fname in session.query(t.Athletes.first_name):
        print(fname)


I get a result yet running

for fname in session.query(t.Athletes.first_name).first():
        print(fname)


the error pasted at the bottom of the message comes up.

Is this a problem because of MySQL-python not being supported for
python32 in conjunction with sqlalchemy and if, what package should I
install? Is there a recommendation for python32? I tried oursql but
couldn't get a simple query to work with it either. The error looks
like the %s is not evaluated?

Very much appreciate any help
Markus


2012-01-24 19:49:13,174 INFO sqlalchemy.engine.base.Engine BEGIN
(implicit)
2012-01-24 19:49:13,174 INFO sqlalchemy.engine.base.Engine b'SELECT
athletes.first_name AS athletes_first_name \nFROM athletes \n LIMIT
%s'
2012-01-24 19:49:13,174 INFO sqlalchemy.engine.base.Engine (1,)
Traceback (most recent call last):
  File "C:\Python32\lib\site-packages\MySQLdb\cursors.py", line 171,
in execute
    r = self._query(query)
  File "C:\Python32\lib\site-packages\MySQLdb\cursors.py", line 330,
in _query
    rowcount = self._do_query(q)
  File "C:\Python32\lib\site-packages\MySQLdb\cursors.py", line 294,
in _do_query
    db.query(q)
_mysql_exceptions.ProgrammingError: (1064, "You have an error in your
SQL syntax; check the manual that corresponds to your MySQL server
version for the right syntax to use near '%s' at line 3")

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
\sqlalchemy\engine\base.py", line 1639, in _execute_context
    context)
  File "C:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
\sqlalchemy\engine\default.py", line 332, in do_execute
    cursor.execute(statement, parameters)
  File "C:\Python32\lib\site-packages\MySQLdb\cursors.py", line 184,
in execute
    self.errorhandler(self, exc, value)
  File "C:\Python32\lib\site-packages\MySQLdb\connections.py", line
36, in defaulterrorhandler
    raise errorclass(errorvalue)
_mysql_exceptions.ProgrammingError: (1064, "You have an error in your
SQL syntax; check the manual that corresponds to your MySQL server
version for the right syntax to use near '%s' at line 3")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "", line 16, in <module>
  File "C:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
\sqlalchemy\orm\query.py", line 1989, in first
    ret = list(self[0:1])
  File "C:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
\sqlalchemy\orm\query.py", line 1883, in __getitem__
    return list(res)
  File "C:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
\sqlalchemy\orm\query.py", line 2058, in __iter__
    return self._execute_and_instances(context)
  File "C:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
\sqlalchemy\orm\query.py", line 2073, in _execute_and_instances
    result = conn.execute(querycontext.statement, self._params)
  File "C:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
\sqlalchemy\engine\base.py", line 1405, in execute
    params)
  File "C:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
\sqlalchemy\engine\base.py", line 1538, in _execute_clauseelement
    compiled_sql, distilled_params
  File "C:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
\sqlalchemy\engine\base.py", line 1646, in _execute_context
    context)
  File "C:\Python32\lib\site-packages\sqlalchemy-0.7.4-py3.2.egg
\sqlalchemy\engine\base.py", line 1783, in _handle_dbapi_exception
    from e
sqlalchemy.exc.ProgrammingError: (ProgrammingError) (1064, "You have
an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near '%s' at line 3")

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to