Open n0thingcode opened 9 months ago
postgreSQL数据库使用update_casbin_site_grouping方法时,错误如下: sqlalchemy.exc.IntegrityError: (psycopg2.errors.NotNullViolation) null value in column "id" of relation "auth_casbin_rule" violates not-null constraint。 错误原因:fastapi_user_auth\utils\sqlachemy_adapter.py内第134行 values.append(self.parse_rule(ptype, rule).dict())
未测试建议:能否在导出dict时排除id字段。修改原同行代码为: values.append(self.parse_rule(ptype, rule).dict(exclude={"id"}))
欢迎测试后提交PR,我这边细节顾不过来
@amisadmin 可以合并一下吗
postgreSQL数据库使用update_casbin_site_grouping方法时,错误如下: sqlalchemy.exc.IntegrityError: (psycopg2.errors.NotNullViolation) null value in column "id" of relation "auth_casbin_rule" violates not-null constraint。 错误原因:fastapi_user_auth\utils\sqlachemy_adapter.py内第134行 values.append(self.parse_rule(ptype, rule).dict())
导出dict时,包含id字段,id字段为NONE,postgreSQL数据库不允许id为null的数据插入。
未测试建议:能否在导出dict时排除id字段。修改原同行代码为: values.append(self.parse_rule(ptype, rule).dict(exclude={"id"}))