On 10/14/15 9:33 AM, Fayaz useful wrote:
> Does it no longer support the autogen_context['imports'] list, like here?
> http://alembic.readthedocs.org/en/latest/autogenerate.html#affecting-the-rendering-of-types-themselves


issue #332 is added to update the documentation and API, please use the
autogen_context._imports collection for now, thanks.

https://bitbucket.org/zzzeek/alembic/issues/332/documentation-for-autogen_context-imports


> 
> On Wed, Oct 14, 2015 at 6:57 PM, Mike Bayer <mike...@zzzcomputing.com
> <mailto:mike...@zzzcomputing.com>> wrote:
> 
> 
> 
>     On 10/14/15 12:41 AM, Fayaz Yusuf Khan wrote:
>     > Hi,
>     > Looks like the autogen_context parameter has changed type recently.
> 
>     indeed it has:
> 
>     
> http://alembic.readthedocs.org/en/latest/api/autogenerate.html#alembic.autogenerate.api.AutogenContext
> 
> 
> 
> 
>     >
>     > I'm getting this exception:
>     >
>     > Traceback (most recent call last):
>     >   File "/home/fayaz/Programming/weaver-env/bin/weaver", line 9, in
>     <module>
>     >     load_entry_point('weaver==2.12.1', 'console_scripts', 'weaver')()
>     >   File
>     >
>     
> "/home/fayaz/Programming/weaver-env/local/lib/python2.7/site-packages/click/core.py",
>     > line 700, in __call__
>     >     return self.main(*args, **kwargs)
>     >   File
>     >
>     
> "/home/fayaz/Programming/weaver-env/local/lib/python2.7/site-packages/click/core.py",
>     > line 680, in main
>     >     rv = self.invoke(ctx)
>     >   File
>     >
>     
> "/home/fayaz/Programming/weaver-env/local/lib/python2.7/site-packages/click/core.py",
>     > line 1027, in invoke
>     >     return _process_result(sub_ctx.command.invoke(sub_ctx))
>     >   File
>     >
>     
> "/home/fayaz/Programming/weaver-env/local/lib/python2.7/site-packages/click/core.py",
>     > line 1027, in invoke
>     >     return _process_result(sub_ctx.command.invoke(sub_ctx))
>     >   File
>     >
>     
> "/home/fayaz/Programming/weaver-env/local/lib/python2.7/site-packages/click/core.py",
>     > line 873, in invoke
>     >     return ctx.invoke(self.callback, **ctx.params)
>     >   File
>     >
>     
> "/home/fayaz/Programming/weaver-env/local/lib/python2.7/site-packages/click/core.py",
>     > line 508, in invoke
>     >     return callback(*args, **kwargs)
>     >   File
>     >
>     
> "/home/fayaz/Programming/weaver-env/local/lib/python2.7/site-packages/click/decorators.py",
>     > line 16, in new_func
>     >     return f(get_current_context(), *args, **kwargs)
>     >   File "/home/fayaz/Programming/weaver-backend/weaver/cli.py",
>     line 44,
>     > in script
>     >     weaver.db.generate_migrate_script(url=ctx.obj, message=message)
>     >   File
>     >
>     "/home/fayaz/Programming/weaver-backend/weaver/db/sql/__init__.py", line
>     > 132, in generate_migrate_script
>     >     make_config(url), message, autogenerate=True)
>     >   File
>     >
>     
> "/home/fayaz/Programming/weaver-env/local/lib/python2.7/site-packages/alembic/command.py",
>     > line 121, in revision
>     >     revision_context.generate_scripts()
>     >   File
>     >
>     
> "/home/fayaz/Programming/weaver-env/local/lib/python2.7/site-packages/alembic/autogenerate/api.py",
>     > line 412, in generate_scripts
>     >     yield self._to_script(generated_revision)
>     >   File
>     >
>     
> "/home/fayaz/Programming/weaver-env/local/lib/python2.7/site-packages/alembic/autogenerate/api.py",
>     > line 336, in _to_script
>     >     autogen_context, migration_script, template_args
>     >   File
>     >
>     
> "/home/fayaz/Programming/weaver-env/local/lib/python2.7/site-packages/alembic/autogenerate/render.py",
>     > line 40, in _render_python_into_templatevars
>     >     _render_cmd_body(upgrade_ops, autogen_context))
>     >   File
>     >
>     
> "/home/fayaz/Programming/weaver-env/local/lib/python2.7/site-packages/alembic/autogenerate/render.py",
>     > line 63, in _render_cmd_body
>     >     lines = render_op(autogen_context, op)
>     >   File
>     >
>     
> "/home/fayaz/Programming/weaver-env/local/lib/python2.7/site-packages/alembic/autogenerate/render.py",
>     > line 75, in render_op
>     >     lines = util.to_list(renderer(autogen_context, op))
>     >   File
>     >
>     
> "/home/fayaz/Programming/weaver-env/local/lib/python2.7/site-packages/alembic/autogenerate/render.py",
>     > line 102, in _render_modify_table
>     >     t_lines = render_op(autogen_context, t_op)
>     >   File
>     >
>     
> "/home/fayaz/Programming/weaver-env/local/lib/python2.7/site-packages/alembic/autogenerate/render.py",
>     > line 75, in render_op
>     >     lines = util.to_list(renderer(autogen_context, op))
>     >   File
>     >
>     
> "/home/fayaz/Programming/weaver-env/local/lib/python2.7/site-packages/alembic/autogenerate/render.py",
>     > line 299, in _add_column
>     >     "column": _render_column(column, autogen_context),
>     >   File
>     >
>     
> "/home/fayaz/Programming/weaver-env/local/lib/python2.7/site-packages/alembic/autogenerate/render.py",
>     > line 542, in _render_column
>     >     'type': _repr_type(column.type, autogen_context),
>     >   File
>     >
>     
> "/home/fayaz/Programming/weaver-env/local/lib/python2.7/site-packages/alembic/autogenerate/render.py",
>     > line 565, in _repr_type
>     >     rendered = _user_defined_render("type", type_, autogen_context)
>     >   File
>     >
>     
> "/home/fayaz/Programming/weaver-env/local/lib/python2.7/site-packages/alembic/autogenerate/render.py",
>     > line 513, in _user_defined_render
>     >     rendered = render(type_, object_, autogen_context)
>     >   File
>     > "/home/fayaz/Programming/weaver-backend/weaver/db/migrations/env.py",
>     > line 52, in render_item
>     >     autogen_context['imports'].add(
>     >
>     >
>     >
>     > Here's the code:
>     >
>     > def render_item(type_, obj, autogen_context):
>     >     from weaver.core.model import PriceType
>     >     if type_ == 'type':
>     >         if isinstance(obj, PriceType):
>     >             print autogen_context
>     >             autogen_context['imports'].add(
>     >                 'from weaver.core.model import PriceType')
>     >             return '%r' % obj
>     >     return False
>     >
>     >
>     > --
>     > You received this message because you are subscribed to the Google
>     > Groups "sqlalchemy-alembic" group.
>     > To unsubscribe from this group and stop receiving emails from it, send
>     > an email to sqlalchemy-alembic+unsubscr...@googlegroups.com
>     <mailto:sqlalchemy-alembic%2bunsubscr...@googlegroups.com>
>     > <mailto:sqlalchemy-alembic+unsubscr...@googlegroups.com
>     <mailto:sqlalchemy-alembic%2bunsubscr...@googlegroups.com>>.
>     > For more options, visit https://groups.google.com/d/optout.
> 
>     --
>     You received this message because you are subscribed to a topic in
>     the Google Groups "sqlalchemy-alembic" group.
>     To unsubscribe from this topic, visit
>     
> https://groups.google.com/d/topic/sqlalchemy-alembic/Tvk2Oqq2PXU/unsubscribe.
>     To unsubscribe from this group and all its topics, send an email to
>     sqlalchemy-alembic+unsubscr...@googlegroups.com
>     <mailto:sqlalchemy-alembic%2bunsubscr...@googlegroups.com>.
>     For more options, visit https://groups.google.com/d/optout.
> 
> 
> 
> 
> -- 
> Fayaz Yusuf Khan
> B.Tech. Computer Science & Engineering(2007-2011)
> Model Engineering College, Kochi, Kerala, India
> +91-9746-830-823
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "sqlalchemy-alembic" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to sqlalchemy-alembic+unsubscr...@googlegroups.com
> <mailto:sqlalchemy-alembic+unsubscr...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy-alembic" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy-alembic+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to