【发布时间】:2021-01-11 10:01:40
【问题描述】:
当我从 sqlite 迁移到 postgres 时,我无法对新数据库进行任何写入。 日志显示以下错误:
Unique key conflict id= 10, already exist in table ab_user
【问题讨论】:
标签: postgresql apache-superset
当我从 sqlite 迁移到 postgres 时,我无法对新数据库进行任何写入。 日志显示以下错误:
Unique key conflict id= 10, already exist in table ab_user
【问题讨论】:
标签: postgresql apache-superset
两种可能的情况:
场景 A:您从零开始,想使用 Postgres 而不是 sqlite。
superset db upgrade 这将在 Postgres 上创建所有表superset init
场景 B:您已经拥有一个已填充的 sqliteDB,并希望将其迁移到 Postgres。
superset db upgrade 和superset init
information_schema.sequences 上的键序列,否则您将遇到唯一键冲突错误。在这两种情况下,您都应该在运行 superset db upgrade 后看到以下消息,这意味着您已经正确配置了 superset_config.py。:
INFO [alembic.runtime.migration] Context impl PostgresqlImpl.
通过设置环境变量确保超集正在查看配置文件:
export PYTHONPATH=/home/local_settings/:$PYTHONPATH
OR
export SUPERSET_CONFIG_PATH=/home/local_settings/
【讨论】: