document SQLAlchemy's policy on case sensitivity in identifier names

Issue #1231 resolved
Former user created an issue

When using sqlalchemy 4.7.1 with oracle 9, I have encountered the following problem:

Problem: When I defined table names, or column names in upper case, and not in lower case, I suffered from a very strange behaviour, although the db is not case sensitive.

Case scenario:

I defined my tables using the mapper. All the tables were defined in upper case. But none of my foreign keys works. sqlalchemy threw an exception that I must explicitly write the primary join expression. After I wrote the primary join condition, it worked fine. Yet, this solution didn't please me. I found out that when I define all the "id" columns explicitly (with autoload = True), it works fine without needing the join condition. I defined them also with upper case. But then, all sort of weird things happened. Only then I found out that all the tables that I defined their columns have two columns for the id - one in upper case and one in lower case. And then I thought to myself, that maybe I should define the table also with lower case. So I did it, and from then on, I didn't have to define the "id" columns explicitly.

Connected to ticket:487.

Reported by Kobi Perl.

Comments (4)

  1. Mike Bayer repo owner

    This ticket is not related to #487.

    SQLAlchemy treats all lower case identifiers as "case insensitive", and all others as "case sensitive". a case sensitive name will use quotes so that the case is represented exactly.

    oracle is particularly confusing in this regard since it displays column names that are case insensitive as all upper case. SQLA normalizes oracle's behavior so that lowercase identifiers should still be used on the SQLA side.

    I thought this was documented in the docstring for Column but apparently not, and its in fact misleading that it says "the identical name" (same for Table). that's not the case.

    add a section to "metadata.txt" and clarify within the docstrings for Table and Column.

  2. Log in to comment