| 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. |
> define a metadata endpoint that maybe returns a JSON schema
We could use an OpenAPI spec[0], which many REST services expose as a JSON endpoint. I think that could work: develop a generic "OpenAPI" FDW, which you can connect like this:
Then we'd map: [0] OpenAPI: https://swagger.io/specification/