gpt4 book ai didi

python - 有没有人尝试在 Apache Superset 中实现 Multi-Tenancy

转载 作者:行者123 更新时间:2023-12-04 09:30:13 25 4
gpt4 key购买 nike

我尝试从 Github 项目克隆,但它对我不起作用。在 Apache 超集中实现 Multi-Tenancy 的任何其他方式。我从这个来源尝试过 https://github.com/apache/incubator-superset/pull/3729/files/5a063f37d77efc0d4a50ba8406a62e8eee4964ed .但我没有实现 Multi-Tenancy 。
我被这些错误困住了。

Traceback (most recent call last):
File "C:\Users\ELCOT\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\ELCOT\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "D:\myfolder\my-superset\venv\Scripts\flask.exe\__main__.py", line 9, in <module>
File "d:\myfolder\my-superset\venv\lib\site-packages\flask\cli.py", line 967, in main
cli.main(args=sys.argv[1:], prog_name="python -m flask" if as_module else None)
File "d:\myfolder\my-superset\venv\lib\site-packages\flask\cli.py", line 586, in main
return super(FlaskGroup, self).main(*args, **kwargs)
File "d:\myfolder\my-superset\venv\lib\site-packages\click\core.py", line 782, in main
rv = self.invoke(ctx)
File "d:\myfolder\my-superset\venv\lib\site-packages\click\core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "d:\myfolder\my-superset\venv\lib\site-packages\click\core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "d:\myfolder\my-superset\venv\lib\site-packages\click\core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "d:\myfolder\my-superset\venv\lib\site-packages\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "d:\myfolder\my-superset\venv\lib\site-packages\click\decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "d:\myfolder\my-superset\venv\lib\site-packages\flask\cli.py", line 425, in decorator
with __ctx.ensure_object(ScriptInfo).load_app().app_context():
File "d:\myfolder\my-superset\venv\lib\site-packages\flask\cli.py", line 388, in load_app
app = locate_app(self, import_name, name)
File "d:\myfolder\my-superset\venv\lib\site-packages\flask\cli.py", line 240, in locate_app
__import__(module_name)
File "D:\myfolder\my-superset\Apache-superset-multi_tenancy_new\superset\__init__.py", line 22, in <module>
from superset.multi_tenant import MultiTenantSecurityManager
File "D:\myfolder\my-superset\Apache-superset-multi_tenancy_new\superset\multi_tenant.py", line 9, in <module>
class MultiTenantUser(User):
File "d:\myfolder\my-superset\venv\lib\site-packages\flask_sqlalchemy\model.py", line 67, in __init__
super(NameMetaMixin, cls).__init__(name, bases, d)
File "d:\myfolder\my-superset\venv\lib\site-packages\flask_sqlalchemy\model.py", line 121, in __init__
super(BindMetaMixin, cls).__init__(name, bases, d)
File "d:\myfolder\my-superset\venv\lib\site-packages\sqlalchemy\ext\declarative\api.py", line 75, in __init__
_as_declarative(cls, classname, cls.__dict__)
File "d:\myfolder\my-superset\venv\lib\site-packages\sqlalchemy\ext\declarative\base.py", line 131, in _as_declarative
_MapperConfig.setup_mapping(cls, classname, dict_)
File "d:\myfolder\my-superset\venv\lib\site-packages\sqlalchemy\ext\declarative\base.py", line 160, in setup_mapping
cfg_cls(cls_, classname, dict_)
File "d:\myfolder\my-superset\venv\lib\site-packages\sqlalchemy\ext\declarative\base.py", line 192, in __init__
self._setup_inheritance()
File "d:\myfolder\my-superset\venv\lib\site-packages\sqlalchemy\ext\declarative\base.py", line 601, in _setup_inheritance
"Can't place __table_args__ on an inherited class "
sqlalchemy.exc.ArgumentError: Can't place __table_args__ on an inherited class with no table.
我无法找到有关此错误的任何解决方案。

最佳答案

有一项名为“行级安全性 (RLS)”的新功能。
https://github.com/apache/incubator-superset/pull/8699
它在 0.36 版中被合并,但有一个错误,所以最后一分钟被排除在外并转移到 0.37。默认情况下它是禁用的,可以在配置文件 superset_config.py 中启用:
ENABLE_ROW_LEVEL_SECURITY = 真
您会在“安全”中找到一些菜单项,它允许您添加将添加到查询中的自定义过滤器。它由数据源配置,过滤器可以依赖于用户角色。 SQL 是免费的,因此非常灵活。所以主要的租户逻辑需要在 SQL 中应用到你的租户模型中。
您也可以使用 JINJA 脚本,但您仅限于在此处超集自己的变量,因为自定义变量将存在于不同的机器上(UI 与后端 aka celery worker)。
该功能已在不同的生产环境中使用(此信息来自开发人员列表)。

关于python - 有没有人尝试在 Apache Superset 中实现 Multi-Tenancy ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62875949/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com