from sqlalchemy import create_engine
from sqlalchemy.sql import text
e = create_engine('oracle://chinook:p4ssw0rd@localhost/xe')
result = e.execute(
text("select * from nchartable where id = '1'"),
).fetchall()
print 'hardcoded:', list(result)
result = e.execute(
text('select * from nchartable where id = :id'),
{'id': '1'}
).fetchall()
print 'trimmed:', list(result)
result = e.execute(
text('select * from nchartable where id = :id'),
{'id': '1 '} # padded with spaces
).fetchall()
print 'padded:', list(result)hardcoded: [(u'1 ',)]trimmed: []padded: [(u'1 ',)]--SQLAlchemy -The Python SQL Toolkit and Object Relational MapperTo post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description.---You received this message because you are subscribed to the Google Groups "sqlalchemy" group.To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/475bbd60-f3d8-486b-a640-5fd58d679af6%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/c313d214-d5a2-455c-b661-3a7cdfb379f2%40www.fastmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/475bbd60-f3d8-486b-a640-5fd58d679af6%40googlegroups.com.
--SQLAlchemy -The Python SQL Toolkit and Object Relational MapperTo post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description.---You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlal...@googlegroups.com.
A bit of advocacy from my side on cx_Oracle: https://github.com/oracle/python-cx_Oracle/issues/365Mike, there's something you might want to look at. We have this monkey patch on SQLAlchemy in our recent code, which was necessary to get the correct behavior for NCHAR columns.from sqlalchemy.dialects.oracle import cx_oraclefrom sqlalchemy.sql sqltypesclass _OracleNChar(sqltypes.NCHAR):def get_dbapi_type(self, dbapi):return dbapi.FIXED_NCHARcx_oracle._OracleNChar = _OracleNCharcx_oracle.dialect.colspecs[sqltypes.NCHAR] = _OracleNChar
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/94e3b8da-415e-434d-bf6a-dbd1a671e576%40googlegroups.com.