Fast upsert mode

未关闭
#34 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
22/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
postgresql, python
领域
backend, database

调研方向

The payload names no source files or tests, so locate the current drop-and-replace load path in the DataPusher+ Python code first. Trace how a resource's datastore table is created and replaced, then find where a per-resource metadata flag could switch that path. Done means an upsert-flagged resource with a matching schema is merged via a temporary table and INSERT ... ON CONFLICT, and a mismatched schema aborts with a clear message. The design is still open, so agree the approach with maintainers first.

由索引模型根据 Issue 内容生成。

描述

enhancement

Currently, DP+ like Datapusher and xloader, only does drop & replace and doesn't do upserts.

It'd be great if DP+ can support upserts in a performant way.

This can be done by:

  • adding a resource-level metadata field that the Data Publisher can set to enable upsert mode.
  • when a resource has upsert mode enabled, instead of drop & replace, DP+ will:
    • compare the schemas of the existing resource and the new CSV to see if they are identical (qsv can do this very quickly)
    • if they're not, DP+ will abort stating that the resource is in upsert mode and the schemas do not match
    • if the schemas are identical, do a PostgreSQL copy to a temporary table of the file to be pushed
    • then do a INSERT INTO ON CONFLICT DO UPDATE to upsert the temporary table into the existing resource
    • the temporary table is then deleted
主要语言
Python
星标
47
派生
33
平均合并
2 小时 28 分钟
30 天内合并 PR
10

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

dathere/datapusher-plus 的其他 Issue

查看 dathere/datapusher-plus 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。