Skip to content

Prevent sqlalchemy_adapter.Adapter from automatically creating tables #9

@nonodev96

Description

@nonodev96

Is there a way to use it only as an intermediary without creating any tables?

I am using sqlalchemy_adapter.Adapter, and I have observed that it automatically creates the corresponding tables in the database during initialization.

My goal is to use the adapter strictly as an intermediary between SQLAlchemy and the system that consumes it, without having it manage or create any tables.

I would like to know:

Whether there is an option or parameter to disable automatic table creation.

Whether there is a recommended way to configure the adapter so that it does not call metadata.create_all() or create any database structures.

Any guidance or references would be appreciated.

engine = get_engine_postgres()

adapter_rbac = sqlalchemy_adapter.Adapter(engine)
# adapter_rebac = sqlalchemy_adapter.Adapter(engine, db_class=CasbinRuleReBAC)
# adapter_rebac = sqlalchemy_adapter.Adapter(engine, table_name=CasbinRuleReBAC.__tablename__)
Lib\site-packages\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):
--- All Policies (p) ---
['alice', '/api/v1/items', 'GET']
--- All Role Assignments (g) ---

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions