[sqlalchemy] Bulk upsert using on_conflict_do_update

2016-12-02 Thread Katie Wurman
What's the proper syntax for doing a bulk upsert using the new on_conflict_do_update clause? In postgres there is apparently a special table called 'excluded' which contains all the rows to be inserted, so the raw query looks like this: INSERT into MYTABLE(col1,col2,col3) VALUES (a,b,c),(d,e,f

Re: [sqlalchemy] Cast model id column from String to Integer

2015-09-16 Thread Katie Wurman
This is a perfectly usable solution. Thanks so much! On Wednesday, September 16, 2015 at 11:39:57 AM UTC-7, Michael Bayer wrote: > > OK, new day, new perspectives. This is the best way to do the mapping / > type: > > class CastToIntegerType(TypeDecorator): > impl = String > > def c

Re: [sqlalchemy] Cast model id column from String to Integer

2015-09-15 Thread Katie Wurman
eaner way to do this? Thanks! On Tuesday, September 15, 2015 at 10:49:51 AM UTC-7, Michael Bayer wrote: > > > > On 9/15/15 1:19 PM, Katie Wurman wrote: > > Hi, > > I'm having trouble implementing a model whose 'id' column needs to be cast > to Integer

[sqlalchemy] Cast model id column from String to Integer

2015-09-15 Thread Katie Wurman
Hi, I'm having trouble implementing a model whose 'id' column needs to be cast to Integer type. Below is the implementation I've got so far: class CastToIntegerType(types.TypeDecorator): ''' Converts stored String values to Integer via CAST operation ''' impl = types.Numeric

Re: [sqlalchemy] Using multiple binds in SQLAlchemy

2015-02-05 Thread Katie Wurman
, Michael Bayer wrote: > > > > Katie Wurman > wrote: > > > I’m trying to design an application that has several engines and unique > models associated with each engine. > > > > Ideally, I’d like to create one base/abstract model per engine, set the >

[sqlalchemy] Using multiple binds in SQLAlchemy

2015-02-04 Thread Katie Wurman
I’m trying to design an application that has several engines and unique models associated with each engine. Ideally, I’d like to create one base/abstract model per engine, set the bind for those, and have all child models inherit that bind. Unfortunately I can’t seem to figure out how that wou