Re: [Sqlalchemy-tickets] [sqlalchemy] #2911: rework of unicode conversion, re: "conditional" as wel
Brought to you by:
zzzeek
|
From: sqlalchemy <mi...@zz...> - 2014-01-17 21:24:11
|
#2911: rework of unicode conversion, re: "conditional" as well as cx_oracle
------------------------------+-------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: new
Priority: high | Milestone: 0.9.xx
Component: cextensions | Severity: major - 1-3 hours
Resolution: | Keywords:
Progress State: in progress |
------------------------------+-------------------------------
Comment (by zzzeek):
working with this script and changing things:
{{{
from sqlalchemy.testing.profiling import profiled
from sqlalchemy import create_engine
engine = create_engine('oracle://scott:tiger@localhost/xe')
try:
engine.execute("DROP TABLE test_stuff")
except:
pass
#engine.execute("CREATE TABLE test_stuff (data nvarchar2(30))")
engine.execute("CREATE TABLE test_stuff (data varchar2(30))")
engine.execute("INSERT INTO test_stuff (data) values (:data)",
[{"data": "d%d" % i} for i in range(50000)])
from sqlalchemy.sql import select, column, cast
from sqlalchemy import Unicode, String
with engine.connect() as conn:
@profiled()
def go():
#result = conn.execute("select * from test_stuff")
result = conn.execute(select([cast(column('data', Unicode),
Unicode(30)).label('data')]).select_from("test_stuff"))
#result = conn.execute(select([column('data',
String)]).select_from("test_stuff"))
row = result.fetchone()
assert isinstance(row['data'], unicode)
for row in result.fetchall():
x = row['data']
go()
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2911#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|