Closed wu-clan closed 1 year ago
@techoner @Nekotoxin
@wu-clan Hi, can you make a PR to fix it?
There is no case for calling asynchronous use in the constructor
@wu-clan thanks for the explanation. I mean, can you make a PR to fix what you said?
Hi, @hsluoyz
This doesn't seem to be a direct fix, as its current logic is to automatically create the casbin_rule table
unless the table creation action is changed to be performed manually
@Wrapping-2000 do you understand what he said? If yes, please do code change
Hi, @hsluoyz
I changed the automatic table creation to manual and added a warning, if there is no better solution
and includes some other fixes, please check: #5
@wu-clan Did your test result pass?
@wu-clan I didn't encounter your error, can you tell me how you encountered the AttributeError?
@wu-clan Did your test result pass?
Yes, I tested sqlalcehmy 1.4.48 and 2.0.8
@wu-clan I didn't encounter your error, can you tell me how you encountered the AttributeError?
This error is raised when sqlalchemy version 2.0.x and async_sessionmaker() are used globally, together with the current version
My console printing (Summary):
File "/home/xx/.virtualenvs/my_project/lib/python3.10/site-packages/casbin_async_sqlalchemy_adapter/adapter.py", line 93, in __init__
Base.metadata.create_all(self._engine)
File "/home/xx/.virtualenvs/my_project/lib/python3.10/site-packages/sqlalchemy/sql/schema.py", line 5581, in create_all
bind._run_ddl_visitor(
AttributeError: 'AsyncEngine' object has no attribute '_run_ddl_visitor'
Please note that this code will raise an error:AttributeError
https://github.com/pycasbin/async-sqlalchemy-adapter/blob/7ad2de0676c258bf36cc29fb45069f5684c4f684/casbin_async_sqlalchemy_adapter/adapter.py#L84
The correct way to open in asynchronous should be:
For detailed examples, please see:https://docs.sqlalchemy.org/en/14/_modules/examples/asyncio/async_orm.html