You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When working with a MS SQL 2008 database through ODBC, all-caps column names in a row must be accessed in lowercase to yield the correct information.
forrowincur.execute("select * from TOTAL_DETAIL where IDENTIFIER = ?", (id, )):
print(row["PRODUCT"]) # Noneprint(row["product"]) # the correct product name
If this is a quirk of ODBC, a possible solution (if it doesn't cause other problems) would be to .lower() all keys before searching the Row-internal dictionary.
The text was updated successfully, but these errors were encountered:
Hi, dict keys are case sensitive natively in language... not as the column names / table names / db names in sql server... to achieve a pseudo-case-insensitiviness lib has done .lower() to all names.
In that way you will have to specify everywhere (and get used to) use lowercased names everywhere in your app (recommended)
import pypyodbc; pypyodbc.lowercase = False
you will have to write names using the ExAcT case in names.
Will be a good idea to replace the native use of dict in lib to use a case-insensitive dict, like this one: https://gist.github.com/babakness/3901174
but there are others available also ...
When working with a MS SQL 2008 database through ODBC, all-caps column names in a row must be accessed in lowercase to yield the correct information.
If this is a quirk of ODBC, a possible solution (if it doesn't cause other problems) would be to
.lower()
all keys before searching theRow
-internal dictionary.The text was updated successfully, but these errors were encountered: