Skip to content

Commit 4846971

Browse files
committed
docs: update README.md for new usage.
1 parent 748c266 commit 4846971

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ pip install sqlalchemy_adapter
2929

3030
## Simple Example
3131

32+
You can save and load policy to database.
33+
3234
```python
3335
import sqlalchemy_adapter
3436
import casbin
@@ -49,6 +51,22 @@ else:
4951
pass
5052
```
5153

54+
By default, policies are stored in the `casbin_rule` table.
55+
You can custom the table where the policy is stored by using the `table_name` parameter.
56+
57+
```python
58+
59+
import sqlalchemy_adapter
60+
import casbin
61+
62+
custom_table_name = "<custom_table_name>"
63+
64+
# create adapter with custom table name.
65+
adapter = sqlalchemy_adapter.Adapter('sqlite:///test.db', table_name=custom_table_name)
66+
67+
e = casbin.Enforcer('path/to/model.conf', adapter)
68+
```
69+
5270

5371
### Getting Help
5472

0 commit comments

Comments
 (0)