Re: [sqlalchemy] Re: Using session.execute to bulk-insert into MySQL

2013-09-30 Thread Roman Iten
In a nutshell -- the call to execute isn't touching the ORM level; just the sqlalchemy core. As such, it's not marking things as changed. Not sure why a rollback is preferred to no activity, but my guess would be it's easier on replication. According to the log, the transaction is neither comm

[sqlalchemy] DeferredReflection with arbitrary Table.name and Table.schema?

2013-09-30 Thread jkmacc
Hi everyone, I've written a declarative model, 'Students,' that I'd like to use in the following ways: 1) Reflect an existing table with an arbitrary table and schema name. It may be an Oracle table called 'master.students2010', or it may be a SQLite table called 'mystudents_2010', but the co

Re: [sqlalchemy] using WITH query AS, cte() with postgresql

2013-09-30 Thread Michael Bayer
here is a demo: from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class Appl(Base): __tablename__ = 'appl' id = Column(Integer, primary_key=True) refid = Column(Integer) lastname = Column(Unicod

[sqlalchemy] Re: Using session.execute to bulk-insert into MySQL

2013-09-30 Thread Jonathan Vanasco
I think the issue might be related to this: https://github.com/zopefoundation/zope.sqlalchemy/blob/master/src/zope/sqlalchemy/datamanager.py#L213 """Record that a flush has occurred on a session's connection. This allows the DataManager to rollback rather than commit on read only transactions

Re: [sqlalchemy] Self-Referential scalar query as column_property

2013-09-30 Thread Michael Bayer
On Sep 30, 2013, at 1:25 PM, Adam Tauno Williams wrote: > I have a table named "project" [class Project] which relates to records > in table "job" [class Task]. I can add a column_property to Project so > that I get a count of the tasks when I instatiante a Project object. > > > class Projec

[sqlalchemy] Self-Referential scalar query as column_property

2013-09-30 Thread Adam Tauno Williams
I have a table named "project" [class Project] which relates to records in table "job" [class Task]. I can add a column_property to Project so that I get a count of the tasks when I instatiante a Project object. class Project(Base) ... task_count = column_property( select([func.

Re: [sqlalchemy] Force SQLAlchemy to not use Unicode

2013-09-30 Thread Michael Bayer
On Sep 30, 2013, at 9:30 AM, Tobias Bell wrote: > Hello > > I'm currently migrating a rather old application built with SQLAlchemy 0.6 > and also an older cx_oracle to use SQLAlchemy 0.8 and cx_oracle 5.1.2. > The problem is, all queries with strings send unicode data to cx_oracle an > cx_ora

[sqlalchemy] Force SQLAlchemy to not use Unicode

2013-09-30 Thread Tobias Bell
Hello I'm currently migrating a rather old application built with SQLAlchemy 0.6 and also an older cx_oracle to use SQLAlchemy 0.8 and cx_oracle 5.1.2. The problem is, all queries with strings send unicode data to cx_oracle an cx_oracle uses NVARCHAR2 to talk to the database. The table itself ha