-
-
Notifications
You must be signed in to change notification settings - Fork 183
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
initialize client with multiple schemas #314
Comments
Yeah, this is an huge issue with the Flutter SDK, isn't it. We will try to figure out a nice way to handle this. |
@dshukertjr |
@nietsmmar |
@dshukertjr |
@rddewan What do you think about a solution like this, where you can specify the schema within the final data = await supabase.from('users', schema: 'custom_schema').select(); |
Actually, let me close this one as there is an issue that is basically trying to tackle the same problem, querying across different schemas. |
Flutter client doesn't seem to support initializing Supabase with multiple schemas and then querying based on those schemas. One client = one schema.
the code below throws this error
This instance is already initialized
A workaround for this is to dispose of the client and re-init it every time a new query is made to a different schema. IMO this doesn't sound that good. I guess it raises some performance issues and other side effects, but maybe not and that's the intended behavior.
Another workaround would be to not use the
Supabase.initialize()
method and init theSupabaseClient
directly:This is a bit of a hack also, this way the
log()
method fromSupabase
class doesn't know about the_debugEnable
flag.Is there another way of doing this?
Edit: I tried solution 2 and it doesn't work.
Supabase.initialize()
must be called, so the way I did it is to call that method which initializes Supabase with the default scheme -public
and then separately initialize other schemas withSupabaseClient()
Currently, the above solution seems to work, but I'm not sure if this is the proper way to do it or if there's another way of doing this. This works for insert/upsert/update queries, but for
select
I don't have a solution to query the from other schemas.An ideal solution would be to init the client with the custom schemas and then for every query to be able to set the schema as an option.
The text was updated successfully, but these errors were encountered: