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

fix: schema access optimization #966

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions supabase/_async/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,11 @@ def schema(self, schema: str) -> AsyncPostgrestClient:

The schema needs to be on the list of exposed schemas inside Supabase.
"""
self._postgrest = self._init_postgrest_client(
rest_url=self.rest_url,
headers=self.options.headers,
schema=schema,
timeout=self.options.postgrest_client_timeout,
)
return self._postgrest
if self.options.schema != schema:
self.options.schema = schema
if self._postgrest:
self._postgrest.schema(schema)
return self.postgrest

def from_(self, table_name: str) -> AsyncRequestBuilder:
"""Perform a table operation.
Expand Down
12 changes: 5 additions & 7 deletions supabase/_sync/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,11 @@ def schema(self, schema: str) -> SyncPostgrestClient:

The schema needs to be on the list of exposed schemas inside Supabase.
"""
self._postgrest = self._init_postgrest_client(
rest_url=self.rest_url,
headers=self.options.headers,
schema=schema,
timeout=self.options.postgrest_client_timeout,
)
return self._postgrest
if self.options.schema != schema:
self.options.schema = schema
if self._postgrest:
self._postgrest.schema(schema)
return self.postgrest

def from_(self, table_name: str) -> SyncRequestBuilder:
"""Perform a table operation.
Expand Down