Skip to content

Warning with declarative base in SQLAlchemy #11

Closed

Description

@nonodev96

SQLAlchemy shows a warning when there are multiple tables with the same name. This might be caused by create_casbin_rule_class when db_class=None in __init__.

I think it's because the class is re-declared and SQLAlchemy doesn't process that it's a dynamic table.

This warning appears during the adapter tests.

Run coverage run -m unittest discover -s tests -t tests
/home/runner/work/sqlalchemy-adapter/sqlalchemy-adapter/sqlalchemy_adapter/adapter.py:33: SAWarning: This declarative base already contains a class with the same class name and module name as sqlalchemy_adapter.adapter.CasbinRule, and will be replaced in the string-lookup table.
  class CasbinRule(Base):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions