Developing a Native Wrapper
Warning
We are not accepting native community Wrappers this repo until the Wrappers API is stabilized. If you have an idea for a Wrapper, you can vote your favorite Wrapper. Once we release Wrappers 1.0, we will support native community Wrappers within the Wrappers repo.
In the meantime you can develop a Wasm wrapper, which can be installed on any Postgres instance with wrappers v0.4.0+
.
To develop a FDW using Wrappers
, you only need to implement the ForeignDataWrapper trait.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
|
In a minimum FDW, which supports data scan only, new()
, begin_scan()
, iter_scan()
and end_scan()
are required, all the other functions are optional.
To know more about FDW development, please visit the Wrappers documentation.
Basic usage
These steps outline how to use the a demo FDW HelloWorldFdw, which only outputs a single line of fake data:
- Clone this repo
1 |
|
- Run it using pgrx with feature:
1 2 |
|
- Create the extension, foreign data wrapper and related objects:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
|
- Run a query to check if it is working:
1 2 3 4 5 |
|
Running tests
In order to run tests in wrappers
:
1 2 |
|
Contribution
All contributions, feature requests, bug report or ideas are welcomed.