File tree Expand file tree Collapse file tree 1 file changed +33
-1
lines changed
singlestoredb/functions/ext Expand file tree Collapse file tree 1 file changed +33
-1
lines changed Original file line number Diff line number Diff line change 6666from ..signature import signature_to_sql
6767from ..typing import Masked
6868from ..typing import Table
69+ from ...config import get_option
70+
6971
7072try :
7173 import cloudpickle
@@ -1111,7 +1113,37 @@ def get_function_info(
11111113 sql_statement = sql ,
11121114 )
11131115
1114- return functions
1116+ # Parse database connection info safely
1117+ connection_info = {}
1118+ database_url = get_option ('url' )
1119+ if database_url :
1120+ from urllib .parse import urlparse
1121+ import re
1122+
1123+ parsed = urlparse (database_url )
1124+
1125+ # Extract service ID from hostname (e.g., svc-12345678-dml.aws-virginia-6.singlestore.com)
1126+ if parsed .hostname :
1127+ # Look for pattern like svc-xxxxxxxx-xxx
1128+ service_match = re .match (r'svc-([a-f0-9]{8})-' , parsed .hostname )
1129+ if service_match :
1130+ connection_info ['service_id' ] = service_match .group (1 )
1131+ else :
1132+ connection_info ['service_id' ] = None
1133+
1134+ # Extract database name from path
1135+ if parsed .path :
1136+ connection_info ['database_name' ] = parsed .path .lstrip ('/' )
1137+
1138+ # Don't include sensitive auth info
1139+ connection_info ['host' ] = parsed .hostname
1140+ connection_info ['port' ] = parsed .port
1141+
1142+
1143+ return {
1144+ 'functions' : functions ,
1145+ 'connection_info' : connection_info
1146+ }
11151147
11161148 def get_create_functions (
11171149 self ,
You can’t perform that action at this time.
0 commit comments