err Im not getting these results....are you on the latest SVN checkout ?
limodou wrote:
> Here is a test:
>
> from sqlalchemy import *
> import datetime
>
> sqlite_engine = create_engine('sqlite://filename=:memory:', echo=True)
>
> a = Table('a', sqlite_engine,
> Column('id', Integer, primary_key = True),
> Column('name', String(4)),
> Column('age', Integer),
> )
> a.create()
>
> class A(object):
> def __init__(self, name='', age=0):
> self.name = name
> self.age = age
>
> def __repr__(self):
> return "name=%s, age=%d" % (self.name, self.age)
>
> assign_mapper(A, a, order_by=[a.c.name])
>
> a = A('b', 3)
> b = A('a', 4)
> objectstore.commit()
>
> for i in A.select():
> print i
>
> It'll complain exception:
>
>
> CREATE TABLE a(
> id INTEGER NOT NULL PRIMARY KEY,
> name VARCHAR(4),
> age INTEGER
> )
>
>
> {}
> INSERT INTO a (name, age) VALUES (?, ?)
> ['b', 3]
> INSERT INTO a (name, age) VALUES (?, ?)
> ['a', 4]
> SELECT a.age AS a_age, a.id AS a_id, a.name AS a_name
> FROM a ORDER BY [<sqlalchemy.schema.Column object at 0x00C69DF0>]
> []
> Traceback (most recent call last):
> File "D:\test\sqlalchemy\t6.py", line 27, in ?
> for i in A.select():
> File
> "c:\python24\lib\site-packages\SQLAlchemy-0.91alpha-py2.4.egg\sqlalchemy\mapping\mapper.py",
> line 399, in select
> return self.select_whereclause(arg, **kwargs)
> File
> "c:\python24\lib\site-packages\SQLAlchemy-0.91alpha-py2.4.egg\sqlalchemy\mapping\mapper.py",
> line 406, in select_whereclause
> return self.select_statement(statement)
> File
> "c:\python24\lib\site-packages\SQLAlchemy-0.91alpha-py2.4.egg\sqlalchemy\mapping\mapper.py",
> line 410, in select_statement
> return self.instances(statement.execute(**params))
> File
> "c:\python24\lib\site-packages\SQLAlchemy-0.91alpha-py2.4.egg\sqlalchemy\sql.py",
> line 376, in execute
> return c.execute(*multiparams, **params)
> File
> "c:\python24\lib\site-packages\SQLAlchemy-0.91alpha-py2.4.egg\sqlalchemy\sql.py",
> line 274, in execute
> return self.engine.execute_compiled(self, params)
> File
> "c:\python24\lib\site-packages\SQLAlchemy-0.91alpha-py2.4.egg\sqlalchemy\engine.py",
> line 387, in execute_compiled
> proxy(str(compiled), parameters)
> File
> "c:\python24\lib\site-packages\SQLAlchemy-0.91alpha-py2.4.egg\sqlalchemy\engine.py",
> line 382, in proxy
> self.execute(statement, parameters, connection=connection,
> cursor=cursor)
> File
> "c:\python24\lib\site-packages\SQLAlchemy-0.91alpha-py2.4.egg\sqlalchemy\engine.py",
> line 435, in execute
> self._execute(cursor, statement, parameters)
> File
> "c:\python24\lib\site-packages\SQLAlchemy-0.91alpha-py2.4.egg\sqlalchemy\engine.py",
> line 444, in _execute
> c.execute(statement, parameters)
> pysqlite2.dbapi2.OperationalError: no such column:
> <sqlalchemy.schema.Column object at 0x00C69DF0>
>
> But if I change the statement:
>
> assign_mapper(A, a, order_by=[a.c.name])
>
> to
>
> assign_mapper(A, a, order_by=a.c.name)
>
> Everything will be ok!
>
> --
> I like python!
> My Blog: http://www.donews.net/limodou
> NewEdit Maillist: http://groups.google.com/group/NewEdit
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> files
> for problems? Stop! Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
> _______________________________________________
> Sqlalchemy-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users
>
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users