On 5/27/15 10:34 PM, Adam Darwin wrote:

Whilst upgrading from sqlalchemy 0.8 to 1.0.4 my ORM has broken with the error Can't redefine 'quote' or 'quote_schema' arguments

I connect to a sybase db, and use a declarative_base

|
|
Base=declarative_base()
|
|

Using a standard method to create the mapping below

|
|
classRiskAggregationGroup(Base): __tablename__ ='RISK_AGGREGATION_GROUP' __table_args__ ={'quote':False,'extend_existing':True} id =Column(Integer,name='id_risk_agg',primary_key=True) name =Column(String(50),name='nm_risk_agg') description =Column(String(100),name='tx_desc')
|
|

This worked fine in sqlalchemy 0.8 but breaks in 1.0.4 as it doesn't like me specifying quote as a table arg. I've tried a whole host of things to get around this, setting it in the base, e.g.

The message you are getting refers to when the table metadata has already been reflected, and the correct identifiers have already been loaded from the database. This is not illustrated here but it seems likely that you are also running a reflection step before you create this declarative base; no such error is emitted otherwise. I would need clarification on that.


throws the same error. If I change it to use the @declared_attr the quoting is not turned off. I'm unable to change the sybase settings and my table names are all caps (which is the cause of the quoting). I've got about 20 tables defined here, so am loathe to change them all to Table creations, such as:

If your table is named in ALL_CAPS (on the database side) and Sybase is considering this in a case-sensitive manner, then you need the quotes. Quoting means, "this name is in exactly this case", so if your statement "my table names are all caps (on the database side, right?)" is true, then you need the quoting.

If you mean "my table names are all caps" on the *Python* side, but they are case insensitive on the Sybase side, then the code is wrong. Change all the identifier names to be lower case.




|
|
classRiskAggregationGroup(Base): __tablename__ ='RISK_AGGREGATION_GROUP' __table__ =Table(__tablename__,Base.metadata,Column(Integer,name='id_risk_agg',primary_key=True,key='id'),Column(String(50),name='nm_risk_agg',key='name'),quote=False)
|
|

Does anyone have a more elegant solution, so far google has failed me?

--
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 sqlalchemy+unsubscr...@googlegroups.com <mailto:sqlalchemy+unsubscr...@googlegroups.com>. To post to this group, send email to sqlalchemy@googlegroups.com <mailto:sqlalchemy@googlegroups.com>.
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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to