GithubHelp home page GithubHelp logo

Comments (4)

christiaanwesterbeek avatar christiaanwesterbeek commented on May 18, 2024

In supabase you can expose multiple schemas. Under the hood supabase is using Postgrest for exposing its api, and Postgrest allows targeting other/multiple schemas using the Accept-Profile and Content-Profile headers.

These 2 headers are not implemented by ra-data-postgrest yet.

I would propose to implement this using React-admin's meta-parameter, in a way that a dataProvider request would look like this.

const { data, isLoading, error } = useGetOne(
    'books',
    {
        id: 1,
        meta: { schema: 'data' }
    },
);

When ra-data-postgrest would find a schema in meta, it would then add the appropriate header (depending on the http method) to make Postgrest query the table/view/function from that schema.

Thoughts?

from ra-data-postgrest.

braco avatar braco commented on May 18, 2024

Thank you!!!

I'm not that familiar with postgrest or react-admin internals, so am probably the wrong person to give feedback.

My generic perspective is that the separation between 'books' and meta.schema.data is strange, and I would expect either a 1. factory method since postgrest apparently exposes only one schema at a time, or 2. simpler notation like 'data.books', since that's where the table is always going to be.

Or what about something like this?

const dataProvider = postgrestRestProvider('....', switchSchema('data'));

or object style

const dataProvider = postgrestRestProvider({ url, schema });

from ra-data-postgrest.

scheiblr avatar scheiblr commented on May 18, 2024

Hey @braco, we are currently working on several improvements and subsequently will add new features. Thus, we currently have kind of a feature-freeze. As of now, I like your suggestion of adding the schema as a parameter.

from ra-data-postgrest.

scheiblr avatar scheiblr commented on May 18, 2024

@braco , I just released v2.0.0-aplha.2 which includes custom schema functionality. Feel free to test it and whether you encounter any issues, I would be glad to hear of it ;) In that case, feel free to reopen this issue or create a new one.

from ra-data-postgrest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.