Thanks for adding this feature! Since I don't know SQLAlchemy that good yet, can you explain exactly what's going on? Do I have to do all the Base related lines? What do they do? If I add this event for an engine in one file/class, does it affect that engine when passed around to other files/classes too?
בתאריך יום רביעי, 27 ביוני 2018 בשעה 21:15:22 UTC+3, מאת Mike Bayer: > > the feature at https://gerrit.sqlalchemy.org/#/c/zzzeek/sqlalchemy/+/795/ > will be part of SQLAlchemy 1.2.9 and will allow the following program > to work: > > > from sqlalchemy import * > from sqlalchemy.orm import * > from sqlalchemy.ext.declarative import declarative_base > from sqlalchemy import event > > Base = declarative_base() > > class A(Base): > __tablename__ = 'a' > > id = Column(Integer, primary_key=True) > data = Column(Text) > > > e = create_engine("oracle://scott:tiger@oracle1120", echo=True) > > # 200x speedup > @event.listens_for(e, "do_setinputsizes") > def _remove_type(inputsizes, cursor, statement, parameters, context): > print(inputsizes) > for param, dbapitype in list(inputsizes.items()): > if dbapitype is e.dialect.dbapi.CLOB: > del inputsizes[param] > > > Base.metadata.drop_all(e) > Base.metadata.create_all(e) > > s = Session(e) > s.add_all([A(id=i, data="foo%d" % i) for i in range(1000)]) > s.commit() > > > On Wed, Jun 20, 2018 at 2:06 AM, naor volkovich <naor2...@gmail.com > <javascript:>> wrote: > > Thanks for opening an issue in cx_oracle, I hope the issue will be > solved in their side. > > You suggested using a lengthed string but I'm using sqlalchemy to create > my table as well and when it sees text, it uses clob automatically... Is > there any way around it like maybe say that small strings will be of > another type of even make it the default and handle errors with big texts > myself? > > > > -- > > SQLAlchemy - > > The Python SQL Toolkit and Object Relational Mapper > > > > http://www.sqlalchemy.org/ > > > > To post example code, please provide an MCVE: Minimal, Complete, and > Verifiable Example. See http://stackoverflow.com/help/mcve for a full > description. > > --- > > 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+...@googlegroups.com <javascript:>. > > To post to this group, send email to sqlal...@googlegroups.com > <javascript:>. > > Visit this group at https://groups.google.com/group/sqlalchemy. > > For more options, visit https://groups.google.com/d/optout. > -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- 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 https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.