supabase / wrappers

Postgres Foreign Data Wrapper development framework in Rust.
http://fdw.dev
Apache License 2.0
562 stars 56 forks source link

feat: add wasm fdw framework with snowflake and paddle fdw #280

Closed burmecia closed 4 months ago

burmecia commented 5 months ago

What kind of change does this PR introduce?

This PR is to add WASM foreign data wrapper prototype with 3 new FDWs developed using this new framework.

All those 3 FDWs are WASM FDWs.

What is the current behavior?

In current framework, all FDWs needs to be compile into a single Postgres extension and then released to Supabase Postgres image and then deployed to Supabase platform. This architecture has many drawbacks:

What is the new behavior?

The new architecture is based on WebAssembly (WASM), each FDW is complied into a WASM component package (Guest) and it is dynamically loaded and run by a new WASM FDW (Host). This consists of 3 parts:

WASM FDW Wrappers

Those 3 parts are quite similar as Docker Host, Container and Docker Hub in concept. Host FDW loads and runs guest FDW when user runs query against a foreign table, and the guest FDWs are published and distributed on FDW registry.

The guest FDW doesn't have to be published on registry, it can be uploaded to anywhere on the internet, as long as the host FDW can access it. The guest FDW can also be a local .wasm file, which is quite useful when developing a new FDW.

Pros:

Cons:

Additional context

The Registry front page:

image