Live data from Hacker News

Supabase Wrappers: A framework for building Postgres foreign data wrappers

supabase.com

31–40 of 47 posts

Re: Supabase Wrappers: A framework for building Postgres foreign data wrappers

#31
So much great postgres stuff comming out from supabase. I'm really impressed with how much focus and direction the team have. So many companies would try to broaden their product/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.

On a sidenote, is not the wrappers for Airtable, BigQuery and ClickHouse opensourced? Or why did they skip that column in the second table?

Is all of supabase opensourced now? I'm meaning I heard something about function not being opensourced but I can be remembering wrong. Most stuff is on GitHub I see

Re: Supabase Wrappers: A framework for building Postgres foreign data wrappers

#32
post #31

So much great postgres stuff comming out from supabase. I'm really impressed with how much focus and direction the team have. So many companies would try to broaden their product/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 look…

> On a sidenote, is not the wrappers for Airtable, BigQuery and ClickHouse opensourced? Or why did they skip that column in the second table?

All of the wrappers are open source. You can see the source for the Airtable, BigQuery, and ClickHouse wrappers here https://github.com/supabase/wrappers/tree/5fac8afb62e6e8362b...

The `self-hosted` column is only missing from the "under development" wrappers in the blog post's table because those are not production ready and shouldn't be self hosted (yet).

> Is all of supabase opensourced now?

Yep! The whole stack is open source and can be self hosted

Re: Supabase Wrappers: A framework for building Postgres foreign data wrappers

#33

hey hn, supabase ceo here 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: https://github.com/supabase/wrappers 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. CREATE FOREIGN TA…

The blog post, repo and your comment still leave me a little confused about what Supabase's wrappers project is, the intent and its current state.

So this "wrappers" project is just a framework that simplifies the development and manages the curation and distribution of Postgres Foreign Data Wrappers? At the end of the day, are these just FDWs that run on top of any Postgres instance? Do I have to run Supabase to take advantage of the FDWs created through this framework?

Additionally one of your examples is Snowflake, but I don't see a matching SF FDW in your repo? Is there a generic JDBC/SQL/etc FDW for any SQL based database like Snowflake, Oracle, etc? Or is this just to create a spark in someone's mind (guilty!) about what is possible and yet to be implemented?

Despite my confusion, this sounds like a very exciting project to follow.

Re: Supabase Wrappers: A framework for building Postgres foreign data wrappers

#34
post #30

Sorry I couldn't figure this out from the docs, but Stripe data is queried "live" from Stripe, right? The abstraction is great, but won't this lead to unexpected N API calls when joining across my domain + Stripe?

Materialized views enable you to "cache" the response, and only refresh it periodically.

Wait, you're telling me that you can create materialized views using foreign tables in Postgres?

Is there a way to propagate changes from the foreign data source through the FDW to Postgres?

Or would it just be some kind of task polls the foreign data source pulling a delta?

Re: Supabase Wrappers: A framework for building Postgres foreign data wrappers

#35
How well do foreign data wrappers work with Postgres's query planner? Does'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?

Also, is the Firebase connector for Realtime Database or Firestore?

Re: Supabase Wrappers: A framework for building Postgres foreign data wrappers

#36

How well do foreign data wrappers work with Postgres's query planner? Does'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? Also, is the Firebase connector for Realtime Database or Firestore?

| How well do foreign data wrappers work with Postgres's query planner?

You can provide table size estimation to Postgres's query planner in wrappers using `get_rel_size()` function, here is doc:

https://docs.rs/supabase-wrappers/latest/supabase_wrappers/i...

| Also, is the Firebase connector for Realtime Database or Firestore?

It is for Firestore, Realtime Database is not supported yet.

Re: Supabase Wrappers: A framework for building Postgres foreign data wrappers

#37
post #4

This is wonderful! 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/tabular format. Is it fair to say though, that FDWs have to run as compiled shared libs? I've always wondered if there can be (like with VS code and language servers) a protocol where we can run a g…

> speaks a particular API over the network it's a interesting idea, and one of the things that we were toying with in our pg_net extension ( https://github.com/supabase/pg_net ). This is a "generic" async network extension, so you can fetch/put/post. It works well for APIs. I think the generic approach works for some things where the data is less "fixed" - for example, an OpenAI API endpoint. But for "fixed" data (da…

I don't think so... in your example those are functions we just call in SQL right? I'm talking about exposing arbitrary data as a table like an FDW, but without having to compile a whole module.

So more like, (this is a bit contrived but bear with me):

Let's say I wanted to make a table that lists all my keybase proofs (so sad Keybase is basically dead, but I digress).

I'd build a graphql endpoint where you can query those proofs.

Then I'd have to define a metadata endpoint that maybe returns a JSON schema?

Then you can tell the FDW to define a virtual table that (as much as possible) uses the JSON schema to generate columns in this virtual table.

You'd define the FDW to say, here's the virtual table (like you'd do now), and then put in an option to say "you'll get the mappings for this table with the JSON schema returned by this metadata endpoint" and then tell the FDW "send select queries to this REST/graphql endpoint" which would be something in our example that returns keybase proofs).

I wouldn't need to build a whole new keybase FDW. I'd just use the generic one to hit that existing endpoint.

Is that making sense? It's kind of a dynamic FDW that can be configured for the long tail of API endpoints.

Re: Supabase Wrappers: A framework for building Postgres foreign data wrappers

#38
post #34
post #30

Earlier quoted context omitted.

Materialized views enable you to "cache" the response, and only refresh it periodically.

Wait, you're telling me that you can create materialized views using foreign tables in Postgres? Is there a way to propagate changes from the foreign data source through the FDW to Postgres? Or would it just be some kind of task polls the foreign data source pulling a delta?

The only option that Postgres's materialized views give you is to "refresh" the view, meaning: re-run the query used to define the view, fetching an entirely new dataset, and use that to replace all the existing data in the view.

There's no facility for deltas, or any other way of propagating changes.

Edit: And to answer your original question, yes you can absolutely base the materialized view on data obtained from a foreign table.

Re: Supabase Wrappers: A framework for building Postgres foreign data wrappers

#39
post #33

hey hn, supabase ceo here 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: https://github.com/supabase/wrappers 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. CREATE FOREIGN TA…

The blog post, repo and your comment still leave me a little confused about what Supabase's wrappers project is, the intent and its current state. So this "wrappers" project is just a framework that simplifies the development and manages the curation and distribution of Postgres Foreign Data Wrappers? At the end of the day, are these just FDWs that run on top of any Postgres instance? Do I have to run Supabase to tak…

| At the end of the day, are these just FDWs that run on top of any Postgres instance?

Yes, the FDWs developed by Wrappers can be used on any Postgres db.

| Do I have to run Supabase to take advantage of the FDWs created through this framework?

No, you don't need to. Those are just normal FDWs can be used on any Postgres db.

| Is there a generic JDBC/SQL/etc FDW for any SQL based database like Snowflake, Oracle, etc?

The Snowflake FDW isn't developed yet, the example is just for concept demo. It has ClickHouse and BigQuery FDWs although they are not JDBC based. Generic JDBC FDW will need JVM embedded so it is not in plan at this moment.

Disclaimer: I am Supabase developer.

Re: Supabase Wrappers: A framework for building Postgres foreign data wrappers

#40
post #34
post #30

Earlier quoted context omitted.

Materialized views enable you to "cache" the response, and only refresh it periodically.

Wait, you're telling me that you can create materialized views using foreign tables in Postgres? Is there a way to propagate changes from the foreign data source through the FDW to Postgres? Or would it just be some kind of task polls the foreign data source pulling a delta?

You can create a custom function doing all the delta logic and use pg_cron to schedule it to periodically materialize data using FDW.
Post reply on HN