Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow overriding default schema in from and rpc #206

Closed
3 tasks
osaxma opened this issue Sep 2, 2022 · 7 comments
Closed
3 tasks

Allow overriding default schema in from and rpc #206

osaxma opened this issue Sep 2, 2022 · 7 comments
Labels
enhancement New feature or request postgrest This issue or pull request is related to postgrest

Comments

@osaxma
Copy link

osaxma commented Sep 2, 2022

Is your feature request related to a problem? Please describe.

Currently it's only possible to use a single schema -- i.e. the one passed to SupabaseClient upon instantiation.

Describe the solution you'd like

In some cases, I would like to run a query or invoke an rpc on a different schema than the one given to SupabaseClient such as:

final client = SupabaseClient('url', 'api_key', schema: 'public');

// some where else in the app
final res = await client.from('table_name', schema: 'api').select().eq('para', para).execute(); 
// or
final res = await client.rpc('some_function', schema: 'api_functions').select().execute();

In the above example, schema should be nullable and if it was not passed then the SupabaseClient.schema is used.

Describe alternatives you've considered

Creating another SupabaseClient seems like the only option but it'd be much easier and cleaner to use the same client.

Tasks

If you agree with the proposed changes, please let me know and I can carry the following tasks:

  • update rpc method on postgrest-dart package
  • update from method, rpc method, and postgrest-dart version on supabase-dart package
  • update supabase-dart version on supabase-flutter package
@osaxma osaxma added the enhancement New feature or request label Sep 2, 2022
@dshukertjr
Copy link
Member

Hi @osaxma,

Thanks for opening this issue! I really like your approach. I think it benefits the supabase-js client library as well to have this feature, so would you mind opening an issue on postgrest-js repo? If they want to implement this feature, let's go through with it on Dart side as well!

@osaxma
Copy link
Author

osaxma commented Sep 5, 2022

Hi @dshukertjr
Sounds good thank you.

Here's the feature request: supabase/postgrest-js#318

@bdlukaa bdlukaa added the postgrest This issue or pull request is related to postgrest label Sep 9, 2022
@dshukertjr
Copy link
Member

dshukertjr commented Sep 27, 2022

For anyone landing here, the discussion on adding this to the JS SDK has been moved here
supabase/postgrest-js#280

This feature will be added once the feature lands on JS SDK.

@bdotsamir
Copy link

Hi all, I've just created a PR over at postgrest-js that handles this case: supabase/postgrest-js#441

@rddewan
Copy link

rddewan commented Jun 28, 2023

@dshukertjr is this available in flutter already ?

@dshukertjr
Copy link
Member

@rddewan Not yet.

@Vinzent03
Copy link
Collaborator

This feature is now available via client.schema("mySchema").from("myTable")
https://github.com/supabase/supabase-flutter/blob/main/CHANGELOG.md#postgrest---v150

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request postgrest This issue or pull request is related to postgrest
Projects
None yet
Development

No branches or pull requests

6 participants