Closed phreakyphoenix closed 9 months ago
Hello @phreakyphoenix! 👋
You can use a wrapper to access custom schemas. However, as of now, you cannot pass options
to create_client()
using this wrapper. In order to update the schema on the postgrest client, you can use the code below:
st_supabase = st.connection(name="supabase_connection", type=SupabaseConnection)
st_supabase.client.postgrest.schema("YOUR_SCHEMA_NAME")
Let me know if you have any other questions.
Thank you so much worked like a charm.
There's one gotcha,
we'd need to redeclare st_supabase.client.postgrest.schema("YOUR_SCHEMA_NAME") before making each table fetch
not sure why, otherwise supabase complains table doesn't exist on public schema, even though the other schema is defined just a few lines above. We can skip it for consecutive st_supabase commands though (without anything else in between like try except etc.) Mentioning it here in case someone else faces this. This happens when using declaring st_supabase both with and without st.session_state.
@phreakyphoenix , I am not able to reproduce the behaviour you mentioned.
I ran multiple fetch statements on a custom schema, both with and without non-st_supabase commands between them and both on same and different tables, and got the results from the custom schema everytime without having to redeclare it.
Could you share a code snippet for me to be able to reproduce this?
Thanks for building this Siddhant. I'm trying to do access a custom schema using this lib.
I think it is possible with supabase-py as described here, but haven't tried myself.
Is it possible to access a custom schema using st-supabase-conenction, if so where do I declare the schema name? It would be helpful to add this bit to the database section in the docs.