MSSQL case sensitivity on INFORMATION_SCHEMA still exists

Issue #1343 resolved
Former user created an issue

ProgrammingError: (ProgrammingError) ('42S02', "42S02 FreeTDSServerInvalid object name 'information_schema.tables'. (208) (SQLPrepare)") u'SELECT tables_1.table_name \nFROM information_schema.tables AS tables_1 \nWHERE tables_1.table_schema = ?' 'dbo'

The query works if I run it by hand with:

FROM INFORMATION_SCHEMA.TABLES AS tables_1

I can also get it to work with:

=================================================================== --- sqlalchemy/databases/information_schema.py (revision 834) +++ sqlalchemy/databases/information_schema.py (working copy) @@ -11,12 +11,12 @@ Column("schema_owner", String), schema="information_schema")

-tables = Table("tables", ischema, +tables = Table("TABLES", ischema, Column("table_catalog", String), Column("table_schema", String), Column("table_name", String), Column("table_type", String), - schema="information_schema") + schema="INFORMATION_SCHEMA")

This is with SA 0.5.2, Python 2.5, OSX 10.5

Comments (6)

  1. Former user Account Deleted

    And a comment where it's used in mssql.py

     def table_names(self, connection, schema):
         from sqlalchemy.databases import information_schema as ischema
    
    • TODO this still has a problem with the case of INFORMATION_SCHEMA

       return ischema.table_names(connection, schema)
      
  2. Michael Trier

    This will definitely be problematic if you're using a binary collation for your database. We need to change the casing of these items so with a binary collation it will properly find the tables.

  3. Log in to comment