Oh, I can reproduce the error without globals too.
Here:
from sqlalchemy.dialects import mysql
def render_item(type_, obj, autogen_context):
    print "This is a global:", mysql
    from sqlalchemy.dialects import mysql as mysql2
    print "This is not a global:", mysql2

Output:
This is a global: None
This is not a global: <module 'sqlalchemy.dialects.mysql' from 
'/home/fayaz/Programming/weaver-env/local/lib/python2.7/site-packages/sqlalchemy/dialects/mysql/__init__.pyc'>


On Wednesday, September 2, 2015 at 8:53:21 PM UTC+5:30, Michael Bayer wrote:
>
>
>
> On 9/2/15 3:13 AM, Fayaz Yusuf Khan wrote:
>
> Hi,
> I'm seeing this weird issue where several global variables in env.py are 
> set as null when accessed from render_item.
>
> Code: env.py
> def render_item(type_, obj, autogen_context):
>     print globals()
>
>
> I'm not deeply familiar with the vagaries of what globals() does other 
> than I tend not to go near it except when doing eval / exec, so I don't 
> have any immediate insight on this one, sorry (as always, I'd pdb it here).
>
>
>
>
> Output:
> {'mysql': None, 'with_statement': None, 'PasswordType': None, 
> 'include_symbol': None, 'PriceType': None, 'JSONEncodedDict': None, 
> 'compare_type': None, 'PhoneNumberType': None, 'run_migrations_online': 
> None, '__package__': None, 'render_item': None, 'target_metadata': None, 
> 'Base': None, 'config': None, '__doc__': None, '__builtins__': 
> {'bytearray': <type 'bytearray'>, 'IndexError': <type 
> 'exceptions.IndexError'>, 'all': <built-in function all>, 'help': Type 
> help() for interactive help, or help(object) for help about object., 
> 'var.....
>
> Recently updated to:
> alembic==0.8.2
> SQLAlchemy==1.0.8
>
> Any ideas why this might be happening?
>
> Thanks.
>
>
>

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