On May 25, 2010, at 2:32 PM, Daniel Mostovoy wrote:
>
> would this binding style issue have an effect in the context of a conditional
> query? Let me give an example based on the same dataset i used in my
> previous mail:
>
> given the following table in both sqlite & oracle 11g, populated with
> identical data:
>
> bondData = Table('BOND_DATA', metadata,
> Column('NORTHINFOID', String(35), primary_key = True),
> Column('NORTHINFO_RATING',String(4))
> # schema = daniel
> )
>
> toggling that last schema line on for oracle & off for sqlite...
>
> i want to create an sql query that returns me a subset of the data where
> NORTHINFO_RATING's value = "AAA". to do this while connected to the sqlite
> instance of the DB i run the following 2 lines:
>
> s = select([bondData], bondData.c.NORTHINFO_RATING == "AAA")
> result = db_engine.execute(s)
>
> here's my problem... this returns an empty dataset, even though there are
> thousands of records that fit the description. when I modify those lines
> slightly to run while connected to oracle, however, I get my desired result:
>
> s=select([bondData], bondData.c.northinfo_rating=="AAA")
> result = db_engine.execute(s)
you can figure out everything that's going on by turning on echo=True and
watching the SQL go by, or 'debug' which will also show result sets. Try the
same SQL in your sqlite3 commandline to see what happens. There could be
character collation issues at play, for example (i.e. maybe you mean to say
'aaa' and not 'AAA').
Its also suspect that you are changing the casing of the table/column names on
each backend and you'd do well to check what the names of the actual tables and
columns are on each backend, and try to get them to all be the same, i.e.
created without quotes and therefore case insensitive.
There is no issue with the binding style.
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.