Skip to content

Commit 0a93fd7

Browse files
Merge branch 'main' of https://github.com/singlestore-labs/singlestoredb-python into users/kaushik/aysnc-support
2 parents 230033f + 93a0018 commit 0a93fd7

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

singlestoredb/apps/_python_udfs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616

1717
async def run_udf_app(
18-
replace_existing: bool,
1918
log_level: str = 'error',
2019
kill_existing_app_server: bool = True,
2120
) -> UdfConnectionInfo:
@@ -55,8 +54,9 @@ async def run_udf_app(
5554
)
5655
_running_server = AwaitableUvicornServer(config)
5756

58-
# Register the functions
59-
app.register_functions(replace=replace_existing)
57+
# Register the functions only if the app is running interactively.
58+
if app_config.running_interactively:
59+
app.register_functions(replace=True)
6060

6161
asyncio.create_task(_running_server.serve())
6262
await _running_server.wait_for_startup()

singlestoredb/functions/ext/asgi.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,13 @@ def get_function_info(
971971
functions = {}
972972
no_default = object()
973973

974+
# Generate CREATE FUNCTION SQL for each function using get_create_functions
975+
create_sqls = self.get_create_functions(replace=True)
976+
sql_map = {}
977+
for (_, info), sql in zip(self.endpoints.values(), create_sqls):
978+
sig = info['signature']
979+
sql_map[sig['name']] = sql
980+
974981
for key, (_, info) in self.endpoints.items():
975982
if not func_name or key == func_name:
976983
sig = info['signature']
@@ -1008,8 +1015,12 @@ def get_function_info(
10081015
if a.get('default', no_default) is not no_default:
10091016
returns[-1]['default'] = a['default']
10101017

1018+
sql = sql_map.get(sig['name'], '')
10111019
functions[sig['name']] = dict(
1012-
args=args, returns=returns, function_type=info['function_type'],
1020+
args=args,
1021+
returns=returns,
1022+
function_type=info['function_type'],
1023+
sql_statement=sql,
10131024
)
10141025

10151026
return functions

0 commit comments

Comments
 (0)