Re: [sqlalchemy] Referencing the object instance from an association proxy creator

2018-09-05 Thread Mike Bayer
On Wed, Sep 5, 2018 at 7:19 PM, Connor wrote: > Hi guys, > > I'm starting to use association proxies for the first time and I've come > across an issue that has me stumped. > > Basically, I want to use the association proxy's "creator" argument in order > to create the intermediate object. > The

[sqlalchemy] Referencing the object instance from an association proxy creator

2018-09-05 Thread Connor
Hi guys, I'm starting to use association proxies for the first time and I've come across an issue that has me stumped. Basically, I want to use the association proxy's "creator" argument in order to create the intermediate object. The intermediate object has foreign keys that point to the

Re: [sqlalchemy] how to set column default value ?

2018-09-05 Thread Mike Bayer
On Wed, Sep 5, 2018 at 11:51 AM, Yingchen Zhang wrote: > db.Column('text_column', db.VARCHAR(20), default='test_text', > server_default='test_text', nullable=True) > > but, generated code like: > > sa.Column('text_column', sa.VARCHAR(20), nullable=True), I assume you are using Alembic

[sqlalchemy] how to set column default value ?

2018-09-05 Thread Yingchen Zhang
db.Column('text_column', db.VARCHAR(20), default='test_text', server_default ='test_text', nullable=True) but, generated code like: sa.Column('text_column', sa.VARCHAR(20), nullable=True), how to set column default value ? -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper

Re: [sqlalchemy] ForeignKeyConstraint using Forward Declared Model

2018-09-05 Thread Mike Bayer
On Tue, Sep 4, 2018 at 11:00 PM, Alex Rothberg wrote: > I tracked down the error on my side. Looks like I have to use the table name > rather than the model name (doh) in the string. That being said, there may > still be a bug in sqla where it tries to read the name off a join (rather > than a

Re: [sqlalchemy] How to customize base declarative class to add naming conventions

2018-09-05 Thread Derek Lambert
Just define the naming convention dict in a separate file and import it into each declarative base? On Wednesday, September 5, 2018 at 4:18:44 AM UTC-5, René-paul Debroize wrote: > > It would have been great to be able to do it via a mixin, I have several > DB using decalarative base

Re: [sqlalchemy] How to customize base declarative class to add naming conventions

2018-09-05 Thread René-paul Debroize
It would have been great to be able to do it via a mixin, I have several DB using decalarative base constructed with this Base mixin and I liked to have the same naming_convention for all the DBs without repeating myself. If it's not I guess i can still manage to find an acceptable way of doing it