TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

JSON Changelog with SQLite

113 点作者 iffycan超过 6 年前

6 条评论

derefr超过 6 年前
I&#x27;ve seen this pattern a couple of times (e.g. for broadcasting changes using Postgres&#x27;s LISTEN&#x2F;NOTIFY.)<p>Each time, I wonder why people are recreating the database&#x27;s journal, within the database, where this meta-journal will <i>itself</i> be getting journaled.<p>Why not just consume the actual DB journal?<p>I&#x27;m not sure how that&#x27;d work for SQLite—it&#x27;d probably require a hack of some sort, since SQLite&#x27;s journal is an ephemeral part of the DB file. But for more full-fledged RDBMSes, this would just be a matter of hijacking a streaming-replication-based backup system to act as a store of record for events. E.g., in the case of Postgres, you&#x27;d just have an ETL pipeline pointed at your WAL-E bucket, parsing through your WAL files either to load into a separate OLAP store, or for stateless map-reduction whenever you need to answer a question.
评论 #17855647 未加载
评论 #17855865 未加载
评论 #17856714 未加载
评论 #17855841 未加载
评论 #17856146 未加载
评论 #17856409 未加载
评论 #17855654 未加载
cannadayr超过 6 年前
I solved this problem by wrapping sqldiff (included w&#x2F; sqlite src) as a custom git diff driver.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;cannadayr&#x2F;git-sqlite" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;cannadayr&#x2F;git-sqlite</a>
radiospiel超过 6 年前
The sqlite sessions extension seems to be a good foundation for getting changelogs out of a sqlite database. It is sadly not too well known: <a href="https:&#x2F;&#x2F;www.sqlite.org&#x2F;sessionintro.html" rel="nofollow">https:&#x2F;&#x2F;www.sqlite.org&#x2F;sessionintro.html</a>
groue超过 6 年前
Related article: &quot;Automatic Undo&#x2F;Redo Using SQLite&quot; <a href="https:&#x2F;&#x2F;www.sqlite.org&#x2F;undoredo.html" rel="nofollow">https:&#x2F;&#x2F;www.sqlite.org&#x2F;undoredo.html</a>
评论 #17859884 未加载
Scaevolus超过 6 年前
Neat! If you wanted to extend this more (string diffs, non-json encodings), a custom function would be the next logical step. In Python it might be:<p><pre><code> import sqlite3 def delta(*args): ret = {} for name, old, new in zip(args[::3], args[1::3], args[2::3]): if old != new: ret[name] = old if ret: return ret db = sqlite3.connect(&#x27;:memory:&#x27;) db.create_function(&#x27;delta1&#x27;, delta, 3) db.create_function(&#x27;delta2&#x27;, delta, 6) db.create_function(&#x27;delta3&#x27;, delta, 9) print db.execute(&#x27;select delta2(&quot;b&quot;, &quot;20&quot;, &quot;20&quot;, &quot;c&quot;, 3.4, 3.6)&#x27;).fetchone() &gt;&gt; (u&#x27;{&quot;c&quot;: 3.4}&#x27;,)</code></pre>
评论 #17856785 未加载
janemanos超过 6 年前
ArangoDB also has a first tool to listen to changes in the database and execute actions or queries. It is limited to a single node. Question is how scalable all of these tools are <a href="https:&#x2F;&#x2F;www.arangodb.com&#x2F;2017&#x2F;03&#x2F;arangochair-tool-listening-changes-arangodb&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.arangodb.com&#x2F;2017&#x2F;03&#x2F;arangochair-tool-listening-...</a>