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

2013-10-01 Thread Jonathan Vanasco
do you recall if `flush()` initiated 'mark_changed' at some point in history? i thought it did. -- 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+unsubs

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

2013-10-01 Thread Michael Bayer
On Oct 1, 2013, at 8:30 PM, Adam Tauno Williams wrote: > > Ok, I have something working; but it seems like there should be a more > elegant way. I am declaring an alias of the Project mapper class in > order to make it work - that seems awkward. it looks fine to me? if you want to query s

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

2013-10-01 Thread Adam Tauno Williams
On Mon, 2013-09-30 at 13:35 -0400, Michael Bayer wrote: > 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

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

2013-10-01 Thread Roman Iten
On 01.10.2013 09:08, Wichert Akkerman wrote: But the transaction is not committed. I discovered that the transaction is committed only if I call add() on DBSession (all five shots are inserted then)… That is expected behaviour: zope.sqlalchemy can only detect changes when you use the ORM. If

Re: [sqlalchemy] Testing custom types

2013-10-01 Thread Michael Bayer
On Oct 1, 2013, at 4:44 PM, Florian Rüchel wrote: > I have created several custom types from base SQLAlchemy types. One example > is a DateTime with integrated timezone support (i.e. it assumes all timezones > are UTC when loading and attaches the tzinfo from pytz to it). Now I want to > test

[sqlalchemy] Testing custom types

2013-10-01 Thread Florian Rüchel
I have created several custom types from base SQLAlchemy types. One example is a DateTime with integrated timezone support (i.e. it assumes all timezones are UTC when loading and attaches the tzinfo from pytz to it). Now I want to test these types. I could just integrate them in my usual tests,

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

2013-10-01 Thread Nathan Mailg
Thanks Mike, that works! I really appreciate you taking the time to show me how to get this working. Do you have an amazon wish list or something like that somewhere? On Sep 30, 2013, at 2:09 PM, Michael Bayer wrote: > qlast, qfirst = 'a', 'b' > d = DBSession.query(Appl).\ > distinct(Appl.r

RE: [sqlalchemy] How to check if relationship is many-to-many?

2013-10-01 Thread Alexey Vihorev
That's great, thanks! From: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com] On Behalf Of Michael Bayer Sent: Tuesday, October 01, 2013 6:20 PM To: sqlalchemy@googlegroups.com Subject: Re: [sqlalchemy] How to check if relationship is many-to-many? for a basic many-to-many th

Re: [sqlalchemy] How to check if relationship is many-to-many?

2013-10-01 Thread Michael Bayer
for a basic many-to-many the relationship will have a non-None "secondary" attribute - relationship.secondary. Or you could check for "relationship.direction is sqlalchemy.orm.interfaces.MANYTOMANY". On Oct 1, 2013, at 9:41 AM, Alexey Vihorev wrote: > Hi! > I'm trying to adapt my GUI app for

Re: [sqlalchemy] Force SQLAlchemy to not use Unicode

2013-10-01 Thread Michael Bayer
here's a full proof-of-concept. see if it works for you and if you can figure out where your real app is diverging from the basic idea: from sqlalchemy import MetaData, Table, Column, String, Integer, create_engine e = create_engine("sqlite://", echo=True) m1 = MetaData() t1 = Table('t1', m1,

[sqlalchemy] How to check if relationship is many-to-many?

2013-10-01 Thread Alexey Vihorev
Hi! I'm trying to adapt my GUI app for handling sqla many-to-many relationships. GUI is auto generated, so I have to find out at run time what relationships should be presented as table views. I tried to use inspection.inspect(MyClass.attribute).uselist to check for it, it it works fine so far, but

Re: [sqlalchemy] Force SQLAlchemy to not use Unicode

2013-10-01 Thread Tobias Bell
Am Montag, 30. September 2013 19:18:01 UTC+2 schrieb 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 p

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

2013-10-01 Thread Wichert Akkerman
This message did not make it to the list last time, lets see if it work now.. On Sep 29, 2013, at 2:41 PM, Roman Iten wrote: > Hi > > I started a pyramid project using the alchemy scaffold (includes > ZopeTransactionExtension to scope sessions to requests, see [1]). > > Trying to insert many