Re: stack trace with key error from: alembic revision --autogenerate -m "first rev"

2015-04-20 Thread Mike Bayer
On 4/20/15 7:11 PM, Dewey Gaedcke wrote: Can someone point me to the attribute chain that would let me reach the Declarative class for a given table object?? In other words, using the args passed to this function: @event.listens_for(Column, "before_parent_attach") def attach(colObj,

Re: stack trace with key error from: alembic revision --autogenerate -m "first rev"

2015-04-20 Thread Dewey Gaedcke
Can someone point me to the attribute chain that would let me reach the Declarative class for a given table object?? In other words, using the args passed to this function: @event.listens_for(Column, "before_parent_attach") def attach(colObj, tableObj): prefix = tableObj.name[0:4] colObj

Re: stack trace with key error from: alembic revision --autogenerate -m "first rev"

2014-12-23 Thread Michael Bayer
Dewey Gaedcke wrote: > All my tables use this exact pattern and so the most hassle free solution > for me is your suggestion: test that table.metadata is Base.metadata, in > the event function before changing the column name > > However, I don't think it will work because inside Alembic env.py

Re: stack trace with key error from: alembic revision --autogenerate -m "first rev"

2014-12-23 Thread Dewey Gaedcke
All my tables use this exact pattern and so the most hassle free solution for me is your suggestion: test that table.metadata is Base.metadata, in the event function before changing the column name However, I don't think it will work because inside Alembic env.py, I have: from model.tables im

Re: stack trace with key error from: alembic revision --autogenerate -m "first rev"

2014-12-23 Thread Michael Bayer
Michael Bayer wrote: > Dewey Gaedcke wrote: > > this is the table that’s being reflected from your database, first of all, > so you definitely don’t want to be changing .name in that case, because it > is set to exactly what the name is in the DB. > > the order of steps is: > > 1. reflectio

Re: stack trace with key error from: alembic revision --autogenerate -m "first rev"

2014-12-23 Thread Michael Bayer
Dewey Gaedcke wrote: > Is it likely that this construct: > > @event.listens_for(Column, "before_parent_attach") > def attach(target, cls): > # cls is the table obj, not the declarative class > target.name = "%s%s" % (cls.name[0:4], target.name) > > is interfering with Alembic?? yes.

stack trace with key error from: alembic revision --autogenerate -m "first rev"

2014-12-23 Thread Dewey Gaedcke
Is it likely that this construct: @event.listens_for(Column, "before_parent_attach") def attach(target, cls): # cls is the table obj, not the declarative class target.name = "%s%s" % (cls.name[0:4], target.name) is interfering with Alembic?? I'm getting this stack trace and it changes i