Skip to content

Commit

Permalink
Merge pull request #69 from trbtm/master
Browse files Browse the repository at this point in the history
feature: Adds the option to supress MetaData.create_all call
  • Loading branch information
leeqvip authored Jul 4, 2024
2 parents 4698e87 + 0a5f6d3 commit 89735d6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions casbin_sqlalchemy_adapter/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Filter:
class Adapter(persist.Adapter, persist.adapters.UpdateAdapter):
"""the interface for Casbin adapters."""

def __init__(self, engine, db_class=None, filtered=False):
def __init__(self, engine, db_class=None, filtered=False, create_all_models=True):
if isinstance(engine, str):
self._engine = create_engine(engine)
else:
Expand All @@ -82,7 +82,8 @@ def __init__(self, engine, db_class=None, filtered=False):
self._db_class = db_class
self.session_local = sessionmaker(bind=self._engine)

Base.metadata.create_all(self._engine)
if create_all_models:
Base.metadata.create_all(self._engine)
self._filtered = filtered

@contextmanager
Expand Down

0 comments on commit 89735d6

Please # to comment.