Skip to content

Commit 4692c2d

Browse files
committed
Patch pre_select supabase
1 parent eda0360 commit 4692c2d

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

src/robusta/core/sinks/robusta/dal/supabase_dal.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from cachetools import TTLCache
1111
import requests
1212
from postgrest._sync.request_builder import SyncQueryRequestBuilder
13-
from postgrest.base_request_builder import BaseFilterRequestBuilder
13+
from postgrest.base_request_builder import BaseFilterRequestBuilder, QueryArgs
1414
from postgrest.exceptions import APIError as PostgrestAPIError
1515
from postgrest.types import ReturnMethod
1616
from postgrest.utils import sanitize_param
@@ -37,6 +37,8 @@
3737
AccountResourceStatusType,
3838
ResourceKind,
3939
)
40+
from postgrest._sync import request_builder as supabase_request_builder
41+
4042

4143
SERVICES_TABLE = "Services"
4244
NODES_TABLE = "Nodes"
@@ -55,6 +57,18 @@
5557
OPENSHIFT_GROUPS_TABLE = "OpenshiftGroups"
5658
SESSION_TOKENS_TABLE = "AuthTokens"
5759

60+
61+
logging.info("Patching supabase_request_builder.pre_select")
62+
original_pre_select = supabase_request_builder.pre_select
63+
def pre_select_patched(*args, **kwargs):
64+
args: QueryArgs = original_pre_select(*args, **kwargs)
65+
if not args.json:
66+
args = QueryArgs(args.method, args.params, args.headers, None)
67+
68+
return args
69+
supabase_request_builder.pre_select = pre_select_patched
70+
71+
5872
class SupabaseDal(AccountResourceFetcher):
5973
def __init__(
6074
self,

0 commit comments

Comments
 (0)