Skip to content

Commit

Permalink
fix: schema access optimization (#966)
Browse files Browse the repository at this point in the history
  • Loading branch information
nzlz authored Oct 18, 2024
1 parent fcea7f4 commit 8f1300e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
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

0 comments on commit 8f1300e

Please sign in to comment.