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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Ask HN: Shared Database Anti(?)-Pattern

5 点作者 cristaloleg大约 3 年前
Hi, looks like another team is interested in one of our tables, they&#x27;re planning to just read, so it will be 100% read-only queries (probably from replica).<p>I&#x27;m curious, how popular&#x2F;acceptable&#x2F;hopeless such pattern is?<p>I understand that giving someone read access to the database isn&#x27;t free (we cannot change schema easily, we cannot change DB, etc) but at the same time, we don&#x27;t need to create a dummy HTTP-service to just do simple queries (and spend more time on unmarshal-marshal stuff).<p>Let&#x27;s assume I&#x27;m asking about Postgres but will be very happy to hear stories or thoughts about other DBs (relational, nosql, graph, wide-column, analytical, inmem, etc) and are there any difference in sharing them practically or architectural.<p>Thank you.

3 条评论

sidmitra大约 3 年前
We use Stitch[1] for this. You can selectively replicate some tables from any &quot;source&quot; to any selected destination[2]. I believe 1 destination is there on the free plan. You can point to any self hosted(or cloud) Postgres DBs. There are a bunch of supported destinations eg. Postgres, Snowflake etc. The sources also can be a varied like Google sheets.<p>We use this to send relevant tables to analytics teams outside of engineering. There&#x27;s a bit of tweaking initially(i.e. having a timestamp column like &#x27;last_updated` helps to replicate only those rows)<p>Having a separate readonly DB user is also pretty common. We use that internally inside engineering(where we trust them slightly more). Important bit is to <i>always</i> add a statement_timeout so people cannot not run random slow queries on your production database that are hung for days.<p>I&#x27;ve also had my eye on <a href="https:&#x2F;&#x2F;www.singer.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.singer.io&#x2F;</a> , which seems like an open source ETL tool similar to Stitch. But i&#x27;ve not experimented with it locally yet. It uses &quot;taps&quot; and &quot;targets&quot; nomenclature. And there&#x27;s a healthy ecosystem of opensource extensions of creating your own taps&#x2F;targets.<p>[1] <a href="https:&#x2F;&#x2F;www.stitchdata.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.stitchdata.com&#x2F;</a><p>[2] <a href="https:&#x2F;&#x2F;www.stitchdata.com&#x2F;integrations&#x2F;destinations&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.stitchdata.com&#x2F;integrations&#x2F;destinations&#x2F;</a>
micahdeath大约 3 年前
It&#x27;s not that you can&#x27;t change the DB. Options could be:<p>- collaborate more with any breaking changes<p>- add features to the DB and keep backwards compatibility<p>- use a DB View so it can be changed as needed and not affect other apps (most similar to an API)<p>- use Stored Procedures instead of direct table access as it gives more compatibility<p>- there are other methods too.
评论 #30934867 未加载
jd_mongodb大约 3 年前
How to mirror an Oracle Table to MongoDB <a href="https:&#x2F;&#x2F;medium.com&#x2F;@johnlpage&#x2F;oracle-pl-sql-and-the-mongodb-data-api-47962a5cfbb4" rel="nofollow">https:&#x2F;&#x2F;medium.com&#x2F;@johnlpage&#x2F;oracle-pl-sql-and-the-mongodb-...</a>