TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Supabase Wrappers: A framework for building Postgres foreign data wrappers

122 pointsby yurisagalovover 2 years ago

11 comments

kiwicoppleover 2 years ago
hey hn, supabase ceo here<p>this one might be more in of a “Show HN” because it’s a pre-release - something that you might want to try yourself or contribute to. The GitHub repo is here: <a href="https:&#x2F;&#x2F;github.com&#x2F;supabase&#x2F;wrappers" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;supabase&#x2F;wrappers</a><p>For context, Postgres has Foreign Data Wrappers (FDW) [0]. These allow you to connect one Postgres database to another, and then query the secondary database directly in the first.<p><pre><code> CREATE FOREIGN TABLE other_database_table ( id integer, title text ) SERVER other_database; </code></pre> The data does not need to be “moved” to the primary database - it stays in the secondary and is fetched when you run a select query:<p><pre><code> select * from other_database_table; </code></pre> Our release today is a framework which extends this functionality to other databases&#x2F;systems. If you’re familiar with Multicorn[1] or Steampipe[2], then it’s very similar. The framework is written in Rust, using the excellent pgx[3].<p>We have developed FDWs for Stripe, Firebase, BigQuery, Clickhouse, and Airtable - all in various pre-release states. We&#x27;ll focus on the systems we’re using internally while we stabalize the framework.<p>There’s a lot in the blog post into our goals for this release. It’s early, but one of the things I’m most excited about.<p>[0] Postgres FDW: <a href="https:&#x2F;&#x2F;www.postgresql.org&#x2F;docs&#x2F;current&#x2F;sql-createforeigndatawrapper.html" rel="nofollow">https:&#x2F;&#x2F;www.postgresql.org&#x2F;docs&#x2F;current&#x2F;sql-createforeigndat...</a><p>[1] Multicorn: <a href="https:&#x2F;&#x2F;multicorn.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;multicorn.org&#x2F;</a><p>[2] Steampipe: <a href="https:&#x2F;&#x2F;steampipe.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;steampipe.io&#x2F;</a><p>[2] pgx: <a href="https:&#x2F;&#x2F;github.com&#x2F;tcdi&#x2F;pgx" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tcdi&#x2F;pgx</a>
评论 #34006846 未加载
评论 #34001680 未加载
atonseover 2 years ago
This is wonderful!<p>I love the pragmatism behind tools like osquery and steampipe that expose a lot of APIs as database tables. It makes these datasets available to non-programmers that are more comfortable with a database&#x2F;tabular format.<p>Is it fair to say though, that FDWs have to run as compiled shared libs? I&#x27;ve always wondered if there can be (like with VS code and language servers) a protocol where we can run a generic FDW that speaks a particular API over the network, and then you can build out-of-process connectors to it and just have to know the usual tools (HTTP, JSON, etc).<p>Thoughts? Maybe this already exists.<p>Then anyone could potentially build a bespoke API&#x2F;dataset and just point an FDW to it.
评论 #34001839 未加载
评论 #34002412 未加载
sisveover 2 years ago
So much great postgres stuff comming out from supabase. I&#x27;m really impressed with how much focus and direction the team have. So many companies would try to broaden their product&#x2F;feature suite, but fail at understanding what made the core sucsessful and stretch the company in many directions. It really seems like they are just making them self better and better experts at postgres. And how to use it well. Really looking forward to see where this is going.<p>On a sidenote, is not the wrappers for Airtable, BigQuery and ClickHouse opensourced? Or why did they skip that column in the second table?<p>Is all of supabase opensourced now? I&#x27;m meaning I heard something about function not being opensourced but I can be remembering wrong. Most stuff is on GitHub I see
评论 #34006210 未加载
nixalaisterover 2 years ago
I&#x27;m excited about Wrappers because of an idea born in the GraphQL community: using GraphQL as the point of integration for many different services in your app. A use case GraphQL seemed made for. It&#x27;s not without problems, though, such as when you need data from one of those services inside your database. So this takes that idea and moves it one level down into the database. You still get the benefits of a unified API (through REST or GraphQL) without the same limitations. I think there couldn&#x27;t be a more ideal point of integration!<p>disclaimer: I am a Supabase employee, but these views are my own.
评论 #34002835 未加载
claytongulickover 2 years ago
I love Supabase and what they&#x27;re doing! I evaluated them heavily when designing architecture for a healthcare product.<p>I&#x27;m not sure about this one though - rust is a great systems language, but it wouldn&#x27;t be my first choice for bridging the db &lt;-&gt; api gap.<p>I wonder why this wasn&#x27;t built on top of, or an enhancement to, the existing (excellent) multicorn[1] project. Python seems like a better choice of language for dealing with io bound problems like talking to remote APIs.<p>Multicorn is mature, stable, well tested and has a ton of FDW implementations already.<p>The dynamic nature of python simplifies the development&#x2F;debug cycle, and serialization to&#x2F;from JSON is easier than in any mainstream language except for javascript.<p>I&#x27;d love to understand more about the technical rationale that drove this.<p>[1] <a href="https:&#x2F;&#x2F;multicorn.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;multicorn.org&#x2F;</a>
评论 #34004045 未加载
abuehrleover 2 years ago
Sorry I couldn&#x27;t figure this out from the docs, but Stripe data is queried &quot;live&quot; from Stripe, right? The abstraction is great, but won&#x27;t this lead to unexpected N API calls when joining across my domain + Stripe?
评论 #34003259 未加载
评论 #34005849 未加载
thedanglerover 2 years ago
So you&#x27;re telling me I can use this to create my own wrapper to get data directly from another API?<p>I can now use this instead of creating my own workflow to get the data via an api which will be stored in the DB anyways?
评论 #34001904 未加载
jzelinskieover 2 years ago
I really want to love foreign data wrappers for Postgres and this seems like a big improvement over existing Python library, but the lack of support for them in managed databases services makes them a non-starter for so many use-cases.<p>Because RDS, for example, will only support the foreign data wrapper for reading from another &quot;Postgres&quot;, what we really need is a server that supports the Postgres wire protocol (easier said than done) and you implement your drivers as a handler to that server.
评论 #34002586 未加载
jansommerover 2 years ago
I&#x27;m eager to start using foreign data wrappers in PG, but there are close to zero benchmarks. Is my database going to break when transactions start piling up because an API I&#x27;m using is slow? Will my TPS drop significantly due to longer transactions? In other words, what am I paying for all this good stuff?
spankaleeover 2 years ago
How well do foreign data wrappers work with Postgres&#x27;s query planner? Does&#x27;t the planner need to estimate the cardinality of results from each table? Are the Supabase wrappers providing this info from the wrappers even though it might be hard to get from the data source?<p>Also, is the Firebase connector for Realtime Database or Firestore?
评论 #34007301 未加载
dennisyover 2 years ago
This seems cool to nerd out to! So thanks for that!<p>But what is the point? Why is this better than making the API call?<p>SQL is for queries, why would I want to do networking with it?
评论 #34005095 未加载
评论 #34005827 未加载