Re: [sqlalchemy] Re: changing polymorphic identity on the fly

2017-08-09 Thread jens . troeger
Thanks, Mike! My implementation uses the single table inheritance model and I would like to (i.e. *need to*) keep the id the same. Talking about the example in the documentation, do I understand you

Re: [sqlalchemy] A story of a field named object... and is it a big deal

2017-08-09 Thread Jonathan Vanasco
On Wednesday, August 9, 2017 at 7:18:03 PM UTC-4, Mike Bayer wrote: > it will work fine > expanding on Mike's response... you're just defining `object` within the scope of the class definition. # `object` is the built-in class Foo(object): object = column() #

Re: [sqlalchemy] Re: changing polymorphic identity on the fly

2017-08-09 Thread Mike Bayer
On Wed, Aug 9, 2017 at 6:53 PM, wrote: > Hi, > > I came upon this thread because I've got almost the exact same question. > Several years on, though, how would I go about promoting polymorphic objects > across siblings today? UPDATE the discriminator name, perform INSERT

Re: [sqlalchemy] A story of a field named object... and is it a big deal

2017-08-09 Thread Mike Bayer
On Wed, Aug 9, 2017 at 6:57 PM, Ken MacKenzie wrote: > yeah but I have it in the model as > > class gltable(Base): > ... > object = column(string(6)) it will work fine, up to you if you want to worry about it, you can always make it: object_ = column("object", string(6))

Re: [sqlalchemy] A story of a field named object... and is it a big deal

2017-08-09 Thread Ken MacKenzie
yeah but I have it in the model as class gltable(Base): ... object = column(string(6)) On Wed, Aug 9, 2017 at 6:33 PM, Mike Bayer wrote: > On Wed, Aug 9, 2017 at 2:12 PM, Ken MacKenzie > wrote: > > So I have been using SQL alchemy to convert

Re: [sqlalchemy] Re: changing polymorphic identity on the fly

2017-08-09 Thread jens . troeger
Hi, I came upon this thread because I've got almost the exact same question. Several years on, though, how would I go about promoting polymorphic objects across siblings today? Thank you! Jens On Tuesday, February 9, 2010 at 4:09:23 AM UTC+10, Michael Bayer wrote: > > Pavel Andreev wrote: >

Re: [sqlalchemy] A story of a field named object... and is it a big deal

2017-08-09 Thread Mike Bayer
On Wed, Aug 9, 2017 at 2:12 PM, Ken MacKenzie wrote: > So I have been using SQL alchemy to convert some unidata data stores into ms > sql data. > > One of the GL components in our system is called object, well object code. > > Most refer to it as object so when I defined my

Re: [sqlalchemy] Guidance regarding nested session usage

2017-08-09 Thread Mike Bayer
On Wed, Aug 9, 2017 at 4:26 PM, Mike Bayer wrote: > made. Which is above, **if you are not using begin() and commit(), > the way we just said you should, then you should turn off > autocommit=True**. arg arg ARG ARG "if you are **not** using begin() and commit(), and

Re: [sqlalchemy] Guidance regarding nested session usage

2017-08-09 Thread Mike Bayer
On Wed, Aug 9, 2017 at 12:14 PM, wrote: > Hey, > > I'd like some help regarding nested session usage please. > > I'm working on an application that has an API layer but also has a lot of > cron jobs (via Celery) and scripts. I'm trying to design the app in a way > that my

[sqlalchemy] Re: Guidance regarding nested session usage

2017-08-09 Thread Jonathan Vanasco
A similar question about another anti-pattern was asked/answered recently. Most of what Mike says applies in this use-case https://groups.google.com/forum/#!topic/sqlalchemy/W_Rn-EwKvZo especially the locking and integrity issues with long-running transactions. He's written about it

[sqlalchemy] A story of a field named object... and is it a big deal

2017-08-09 Thread Ken MacKenzie
So I have been using SQL alchemy to convert some unidata data stores into ms sql data. One of the GL components in our system is called object, well object code. Most refer to it as object so when I defined my model for the table including it I named it object. It all works fine, but object

[sqlalchemy] Guidance regarding nested session usage

2017-08-09 Thread alex
Hey, I'd like some help regarding nested session usage please. I'm working on an application that has an API layer but also has a lot of cron jobs (via Celery) and scripts. I'm trying to design the app in a way that my "business" logic is contained and re-usable by any of these interfaces.