Skip to content

cannot import name '_NONE_NAME' from 'sqlalchemy.sql.naming #1196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
shuvamgrad opened this issue Mar 7, 2023 · 5 comments
Closed

cannot import name '_NONE_NAME' from 'sqlalchemy.sql.naming #1196

shuvamgrad opened this issue Mar 7, 2023 · 5 comments
Labels

Comments

@shuvamgrad
Copy link

Describe the bug

having this error for the first time while deploying in docker, using CI/CD. No recent changes in packages

Optional link from https://docs.sqlalchemy.org which documents the behavior that is expected

No response

SQLAlchemy Version in Use

SQLAlchemy==1.3.10

DBAPI (i.e. the database driver)

psycopg2-binary==2.8.4

Database Vendor and Major Version

postgres:9.6.5

Python Version

3.7

Operating system

LINUX

To Reproduce

err:     from sqlalchemy.sql.naming import _NONE_NAME as _NONE_NAME
err: ImportError: cannot import name '_NONE_NAME' from 'sqlalchemy.sql.naming' (/usr/local/lib/python3.7/site-packages/sqlalchemy/sql/naming.py)

Error

# Copy the complete stack trace and error message here, including SQL log output if applicable.

err: File "/usr/local/bin/flask", line 8, in

26 | err: sys.exit(main())
27 | err: File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 967, in main
28 | err: cli.main(args=sys.argv[1:], prog_name="python -m flask" if as_module else None)
29 | err: File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 586, in main
30 | err: return super(FlaskGroup, self).main(*args, **kwargs)
31 | err: File "/usr/local/lib/python3.7/site-packages/click/core.py", line 782, in main
32 | err: rv = self.invoke(ctx)
33 | err: File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1254, in invoke
34 | err: cmd_name, cmd, args = self.resolve_command(ctx, args)
35 | err: File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1297, in resolve_command
36 | err: cmd = self.get_command(ctx, cmd_name)
37 | err: File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 527, in get_command
38 | err: self._load_plugin_commands()
39 | err: File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 523, in _load_plugin_commands
40 | err: self.add_command(ep.load(), ep.name)
41 | err: File "/usr/local/lib/python3.7/site-packages/pkg_resources/init.py", line 2450, in load
42 | err: return self.resolve()
43 | err: File "/usr/local/lib/python3.7/site-packages/pkg_resources/init.py", line 2456, in resolve
44 | err: module = import(self.module_name, fromlist=['name'], level=0)
45 | err: File "/usr/local/lib/python3.7/site-packages/flask_migrate/init.py", line 11, in
46 | err: from alembic import version as alembic_version
47 | err: File "/usr/local/lib/python3.7/site-packages/alembic/init.py", line 3, in
48 | err: from . import context
49 | err: File "/usr/local/lib/python3.7/site-packages/alembic/context.py", line 1, in
50 | err: from .runtime.environment import EnvironmentContext
51 | err: File "/usr/local/lib/python3.7/site-packages/alembic/runtime/environment.py", line 15, in
52 | err: from .migration import _ProxyTransaction
53 | err: File "/usr/local/lib/python3.7/site-packages/alembic/runtime/migration.py", line 29, in
54 | err: from .. import ddl
55 | err: File "/usr/local/lib/python3.7/site-packages/alembic/ddl/init.py", line 1, in
56 | err: from . import mssql
57 | err: File "/usr/local/lib/python3.7/site-packages/alembic/ddl/mssql.py", line 17, in
58 | err: from .base import AddColumn
59 | err: File "/usr/local/lib/python3.7/site-packages/alembic/ddl/base.py", line 16, in
60 | err: from ..util.sqla_compat import _columns_for_constraint # noqa
61 | err: File "/usr/local/lib/python3.7/site-packages/alembic/util/init.py", line 16, in
62 | err: from .messaging import err
63 | err: File "/usr/local/lib/python3.7/site-packages/alembic/util/messaging.py", line 16, in
64 | err: from . import sqla_compat
65 | err: File "/usr/local/lib/python3.7/site-packages/alembic/util/sqla_compat.py", line 30, in
66 | err: from sqlalchemy.sql.naming import _NONE_NAME as _NONE_NAME
67 | err: ImportError: cannot import name '_NONE_NAME' from 'sqlalchemy.sql.naming' (/usr/local/lib/python3.7/site-packages/sqlalchemy/sql/naming.py)

Additional context

No response

@shuvamgrad shuvamgrad added the requires triage New issue that requires categorization label Mar 7, 2023
@zzzeek
Copy link
Member

zzzeek commented Mar 7, 2023

hi -

please upgrade SQLAlhcemy to 1.3.24

@zzzeek zzzeek transferred this issue from sqlalchemy/sqlalchemy Mar 7, 2023
@zzzeek zzzeek added bug Something isn't working batch migrations regression and removed requires triage New issue that requires categorization labels Mar 7, 2023
@sqla-tester
Copy link
Collaborator

Mike Bayer has proposed a fix for this issue in the main branch:

mock _NONE_NAME for < 1.3.24 https://gerrit.sqlalchemy.org/c/sqlalchemy/alembic/+/4497

@zachliu
Copy link

zachliu commented Mar 8, 2023

i have exactly the same issue
getredash/redash was broken by this
upgrading SQLAlchemy from 1.3.10 to 1.3.24 fixed it

@shuvamgrad
Copy link
Author

After upgrading to 1.3.24, I am getting this error

/python3.7/site-packages/sqlalchemy/inspection.py", line 73, in inspect
"available for object of type %s" % type_
sqlalchemy.exc.NoInspectionAvailable: No inspection system is available for object of type <class 'method'>

@Eyal-Bahar
Copy link

My solution: I forcibly downgraded alembic to be alembic==1.8.1 and it solved it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants