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

feat: DeclarativeBase import fails with SQLAlchemy 1.x #66

Merged
merged 1 commit into from Mar 28, 2024

Conversation

sean-donoghue
Copy link
Contributor

Fix for the following when installed version of SQLAlchemy is < 2.0 (requirements still list SQLAlchemy>=1.2.18):

>>> from casbin_sqlalchemy_adapter import Adapter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../lib/python3.11/site-packages/casbin_sqlalchemy_adapter/__init__.py", line 1, in <module>
    from .adapter import CasbinRule, Adapter, Base
  File ".../lib/python3.11/site-packages/casbin_sqlalchemy_adapter/adapter.py", line 6, in <module>
    from sqlalchemy.orm import sessionmaker, DeclarativeBase
ImportError: cannot import name 'DeclarativeBase' from 'sqlalchemy.orm' (.../lib/python3.11/site-packages/sqlalchemy/orm/__init__.py)__init__.py)

Signed-off-by: Sean Donoghue <sean.donoghue@pm.me>
@casbin-bot
Copy link

@Nekotoxin please review

@CLAassistant
Copy link

CLAassistant commented Mar 28, 2024

CLA assistant check
All committers have signed the CLA.

@hsluoyz hsluoyz changed the title fix: DeclarativeBase import fails with SQLAlchemy 1.x feat: DeclarativeBase import fails with SQLAlchemy 1.x Mar 28, 2024
@hsluoyz hsluoyz merged commit 8b03bab into pycasbin:master Mar 28, 2024
12 checks passed
github-actions bot pushed a commit that referenced this pull request Mar 28, 2024
# [1.1.0](v1.0.0...v1.1.0) (2024-03-28)

### Features

* DeclarativeBase import fails with SQLAlchemy 1.x ([#66](#66)) ([8b03bab](8b03bab))
Copy link

🎉 This PR is included in version 1.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

None yet

4 participants