Since upgrading to 0.3.8 (from 0.3.6), I've run in to a problem with long
identifiers.  It seems that _truncate_bindparam is being applied to both
parts of the ClauseElements (that is, the parts both before and after the
AS), and is testing >= (instead of >) max_identifier_length, so that when I
have a column identifier that is the maximum length, it ends up creating a
"no such column" error.

An example test-case follows:

        from sqlalchemy import *
        from sqlalchemy.engine.url import URL

        class Underwriter(object):
            def __init__(self, source, explan):
                self.primaryHeatSource = source
                self.primaryHeatSourceExplan = explan

        def init_database(db):
            metadata = BoundMetaData(db)
            underwriting = Table('und_underwriting_tbl', metadata,
                Column('und_underwriting_id', Integer, primary_key=True,
key='id'),
                Column('und_primary_heat_source', String(20),
key='primaryHeatSource'),
                Column('und_primary_heat_source_explan', String(100),
key='primaryHeatSourceExplan'),
            )

            mapper(Underwriter, underwriting)

            # Add a test record to the DB
            session = create_session()
            underwriting.create() 
            uw = Underwriter('bonfire', 'Maybe she lives in the woods?')
            session.save(uw)
            session.flush()
            session.close()

        db = create_engine(URL(drivername='sqlite', database=':memory:'))

        # simulate running under Oracle
        db.dialect.max_identifier_length = lambda: 30

        db.echo = True

        # insert for test record seems to work OK
        init_database(db)

        session = create_session()

        # select, however, fails
        query = session.query(Underwriter)
        underwriters = query.select()

        session.close()

Throws the following error (note the
"und_underwriting_tbl.und_primary_heat_source__1 AS
und_underwriting_tbl_und_2"):

          ...
          File "build\bdist.win32\egg\sqlalchemy\engine\base.py", line 602,
in _execute
        sqlalchemy.exceptions.SQLError: (OperationalError) no such column:
und_underwriting_tbl.und_primary_heat_source__1 u'SELECT
und_underwriting_tbl.und_primary_heat_source__1 AS
und_underwriting_tbl_und_2, und_underwriting_tbl.und_underwriting_id AS
und_underwriting_tbl_und_3, und_underwriting_tbl.und_primary_heat_source AS
und_underwriting_tbl_und_4 \nFROM und_underwriting_tbl ORDER BY
und_underwriting_tbl.oid' []


Thank you,

Cory Johns
Systems
Tower Hill Insurance Group, Inc.





CONFIDENTIAL NOTICE: This email including any attachments, contains 
confidential information belonging to the sender. It may also be 
privileged or otherwise protected by work product immunity or other 
legal rules. This information is intended only for the use of the 
individual or entity named above.  If you are not the intended 
recipient, you are hereby notified that any disclosure, copying, 
distribution or the taking of any action in reliance on the contents 
of this emailed information is strictly prohibited.  If you have 
received this email in error, please immediately notify us by 
reply email of the error and then delete this email immediately.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to