Skip to content
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

Add support for SQLAlchemy 1.4 #474

Closed
rudaporto opened this issue Sep 10, 2020 · 10 comments
Closed

Add support for SQLAlchemy 1.4 #474

rudaporto opened this issue Sep 10, 2020 · 10 comments

Comments

@rudaporto
Copy link

I know that it's very fresh and still beta but it would be good to start preparing for that.

@matthewsmar
Copy link

Here is some more detail.

An example of the kind of errors we are currently seeing

/Users/mem/env/vita-homebrew/lib/python3.8/site-packages/sqlalchemy_continuum/__init__.py:3: in <module>
    from .manager import VersioningManager
/Users/mem/env/vita-homebrew/lib/python3.8/site-packages/sqlalchemy_continuum/manager.py:6: in <module>
    from sqlalchemy_utils import get_column_key
/Users/mem/env/vita-homebrew/lib/python3.8/site-packages/sqlalchemy_utils/__init__.py:1: in <module>
    from .aggregates import aggregated  # noqa
/Users/mem/env/vita-homebrew/lib/python3.8/site-packages/sqlalchemy_utils/aggregates.py:372: in <module>
    from .functions.orm import get_column_key
/Users/mem/env/vita-homebrew/lib/python3.8/site-packages/sqlalchemy_utils/functions/__init__.py:1: in <module>
    from .database import (  # noqa
/Users/mem/env/vita-homebrew/lib/python3.8/site-packages/sqlalchemy_utils/functions/database.py:11: in <module>
    from .orm import quote
/Users/mem/env/vita-homebrew/lib/python3.8/site-packages/sqlalchemy_utils/functions/orm.py:14: in <module>
    from sqlalchemy.orm.query import _ColumnEntity
E   ImportError: cannot import name '_ColumnEntity' from 'sqlalchemy.orm.query' (/Users/mem/env/vita-homebrew/lib/python3.8/site-packages/sqlalchemy/orm/query.py)

@kvesteri
Copy link
Owner

kvesteri commented Nov 9, 2020

PRs welcome

@jace
Copy link

jace commented Nov 21, 2020

_ColumnEntity has been relocated from sqlalchemy.orm.query to sqlalchemy.orm.context. Apart from this import, there are a couple dotted references in the file that need updating.

@jakeogh
Copy link

jakeogh commented Feb 13, 2021

Using the branch from #482 (because I hit #462 first) and git-latest sqlalchemy:

$ ipython
Python 3.8.7 (default, Jan 31 2021, 08:59:01) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.19.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: /home/user >>>: from sqlalchemy_utils.functions import database_exists

In [2]: /home/user >>>: database_exists('postgresql://postgres@localhost/nope')
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-9a02dbb071e9> in <module>
----> 1 database_exists('postgresql://postgres@localhost/nope')

/usr/lib/python3.8/site-packages/sqlalchemy_utils/functions/database.py in database_exists(url)
    459 
    460     url = copy(make_url(url))
--> 461     database, url.database = url.database, None
    462     engine = sa.create_engine(url)
    463 

AttributeError: can't set attribute

In [3]: /home/user >>>: from sqlalchemy_utils.functions import create_database

In [4]: /home/user >>>: create_database('postgresql://postgres@localhost/nope')
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-4-9209dbd233cb> in <module>
----> 1 create_database('postgresql://postgres@localhost/nope')

/usr/lib/python3.8/site-packages/sqlalchemy_utils/functions/database.py in create_database(url, encoding, template)
    524 
    525     if url.drivername.startswith('postgres'):
--> 526         url.database = 'postgres'
    527     elif url.drivername.startswith('mssql'):
    528         url.database = 'master'

AttributeError: can't set attribute

In [5]: /home/user >>>: 

@uranusjr
Copy link

Should this be closed now that 0.37.0 is released with SQLAlchemy 1.4 support?

@gepuro
Copy link

gepuro commented Apr 21, 2021

In my environment, I solved this problem to update 0.36.8 to 0.37.0 on SQLAlchemy 1.4.

@proteeti13
Copy link

In my environment, I solved this problem to update 0.36.8 to 0.37.0 on SQLAlchemy 1.4.

Hello! I am facing the same error. Can you help me by elaborating which library you are referring to by saying "update 0.36.8 to 0.37.0" ? Thanks.

@nsoranzo
Copy link
Contributor

Should this be closed now that 0.37.0 is released with SQLAlchemy 1.4 support?

Yes, this should be closed.

In my environment, I solved this problem to update 0.36.8 to 0.37.0 on SQLAlchemy 1.4.

Hello! I am facing the same error. Can you help me by elaborating which library you are referring to by saying "update 0.36.8 to 0.37.0" ? Thanks.

SQLAlchemy-Utils (latest is 0.37.2).

@vjpraagsh
Copy link

superset db upgrade
Traceback (most recent call last):
File "/usr/local/bin/superset", line 5, in
from superset.cli import superset
File "/usr/local/lib/python3.6/site-packages/superset/init.py", line 21, in
from superset.app import create_app
File "/usr/local/lib/python3.6/site-packages/superset/app.py", line 24, in
from flask_appbuilder import expose, IndexView
File "/usr/local/lib/python3.6/site-packages/flask_appbuilder/init.py", line 5, in
from .api import ModelRestApi # noqa: F401
File "/usr/local/lib/python3.6/site-packages/flask_appbuilder/api/init.py", line 21, in
from .convert import Model2SchemaConverter
File "/usr/local/lib/python3.6/site-packages/flask_appbuilder/api/convert.py", line 4, in
from flask_appbuilder.models.sqla.interface import SQLAInterface
File "/usr/local/lib/python3.6/site-packages/flask_appbuilder/models/sqla/interface.py", line 40, in
from sqlalchemy_utils.types.uuid import UUIDType
File "/usr/local/lib/python3.6/site-packages/sqlalchemy_utils/init.py", line 1, in
from .aggregates import aggregated # noqa
File "/usr/local/lib/python3.6/site-packages/sqlalchemy_utils/aggregates.py", line 372, in
from .functions.orm import get_column_key
File "/usr/local/lib/python3.6/site-packages/sqlalchemy_utils/functions/init.py", line 1, in
from .database import ( # noqa
File "/usr/local/lib/python3.6/site-packages/sqlalchemy_utils/functions/database.py", line 11, in
from .orm import quote
File "/usr/local/lib/python3.6/site-packages/sqlalchemy_utils/functions/orm.py", line 14, in
from sqlalchemy.orm.query import _ColumnEntity
ImportError: cannot import name '_ColumnEntity'

@kurtmckee
Copy link
Collaborator

kurtmckee commented Jul 11, 2022

@vjpraagsh Please open a new issue and include:

  • sqlalchemy version
  • sqlalchemy-utils version

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

No branches or pull requests