postgrest icon indicating copy to clipboard operation
postgrest copied to clipboard

PostgREST configuration available in db_root_spec session

Open wayland opened this issue 2 years ago • 2 comments

Hi!

I'm helping with the effort to rewrite the OpenAPI stuff in SQL, in a separate module. I wanted to bring to the attention of the PostgREST devs one of the features that we'll need to have added to PostgREST to complete this work.

We need access to some of the configuration parameters from SQL. Our thought is that PostgREST can run some set_config statements in SQL before calling pgrst.db_root_spec. The parameters we currently need are:

Need:

  • pgrst.server_host and pgrst.server_port (or alternately server_proxy_uri -- just let us know which)
  • pgrst.db_schemas
  • pgrst.version

Thanks!

wayland avatar Oct 28 '23 09:10 wayland

@wayland Would you like to help with this?

The configs are set here:

https://github.com/PostgREST/postgrest/blob/c3301a165377f218db0abed217cf29ea3bbd9254/src/PostgREST/Query.hs#L236-L258

steve-chavez avatar Nov 28 '23 13:11 steve-chavez

Thanks! Hopefully I'll get to this eventually.

My goal is to hook jsonforms-editor ( https://jsonforms-editor.netlify.app/ ) to this, and hopefully, I'll be able to add queries to Postgres, and forms will appear in the webapp.

The pieces I still need to hook together are:

  • A build (docker-compose) that includes PostgREST, DataWharf, and some kind of ETL (maybe Apache Nifi?)
  • Get OpenAPI 3.1+ working in Postgres
  • A jsonforms-editor based app (to add to the build above)
  • This ticket here (the last piece, because I've almost no experience with Haskell -- as a Perl programmer (with some Raku), though, I'm closer to functional languages than the average coder)

If I get the OpenAPI stuff finished, I might dive into this before the jsonforms stuff, though; hopefully it'll be a smaller task.

wayland avatar Nov 30 '23 09:11 wayland