On 10/5/15 5:21 AM, Massimiliano della Rovere wrote:
The quoted_name tracebacks (i.e. is not enough) with at FOREIGN KEYS, probably with other constructs too.

# this works fine
Table(
   quoted_name("x", quote=True),
   metadata,
   schema=schemaname,
   autoload=True,
   extend_existing=True)

# this raises "NoSuchTableError: x"
Table(
   quoted_name("y", quote=True),
   metadata,
   schema=schemaname,
   autoload=True,
   extend_existing=True)


It would be useful to have an "always quote all identifiers" (Table, Index, Reference, ...) parameter, so that the quoted_name function keeps on being applied recursively when nesting-calls any of the following functions:

that would be to broad-based, it's very unlikely that a schema has 100% of all identifiers quoted as lower case. Quoting is not safe to use for identifiers that aren't quoted on the database side because SQLAlchemy represents case insensitive using all lower case whereas oracle uses all upper case.

As mentioned earlier, this is a simple bug so I've gone ahead and created the issue at https://bitbucket.org/zzzeek/sqlalchemy/issues/3548/ which is now fixed for 1.0.9.




        self._reflect_column
        self._reflect_pk
        self._reflect_fk
        self._reflect_indexes
        self._reflect_unique_constraints
        self._reflect_...



Il giorno venerdì 2 ottobre 2015 17:12:12 UTC+2, Michael Bayer ha scritto:



    On 10/2/15 9:44 AM, Massimiliano della Rovere wrote:
    cx-Oracle==5.2
    SQLAlchemy==1.0.8

    I'm in the weird situation of dealing with an Oracle database
    with lowercase identifiers (they were created by another software
    that escapes always table/schema/index identifiers).

    I get a "NoSuchTableError" whenever I issue a

    MetaData(bind=engine, reflect=True)

    or a

    Table(
        "tablename",
        metadata,
        schema="SCHEMA",
        autoload=True,
        extend_existing=True,
        quote=True)

    statement and it doesn't change whether the "quote" parameter is
    added or not.

    Is there a way to make SQLAlchemy escape identifiers always,
    without case mangling?

    you get NoSuchTable on straight MetaData(reflect=True)?    Please
    post a bug report with the full table def I'd have to test that.

    using quoted_name will definitely quote the value:
    
http://docs.sqlalchemy.org/en/rel_1_0/core/sqlelement.html?highlight=quoted#sqlalchemy.sql.elements.quoted_name
    
<http://docs.sqlalchemy.org/en/rel_1_0/core/sqlelement.html?highlight=quoted#sqlalchemy.sql.elements.quoted_name>







    Thanks
-- You received this message because you are subscribed to the
    Google Groups "sqlalchemy" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to [email protected] <javascript:>.
    To post to this group, send email to [email protected]
    <javascript:>.
    Visit this group at http://groups.google.com/group/sqlalchemy
    <http://groups.google.com/group/sqlalchemy>.
    For more options, visit https://groups.google.com/d/optout
    <https://groups.google.com/d/optout>.

--
You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To post to this group, send email to [email protected] <mailto:[email protected]>.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to