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,
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
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
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
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
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.
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