File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change 1515
1616
1717async 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 ()
Original file line number Diff line number Diff line change @@ -964,6 +964,13 @@ def get_function_info(
964964 functions = {}
965965 no_default = object ()
966966
967+ # Generate CREATE FUNCTION SQL for each function using get_create_functions
968+ create_sqls = self .get_create_functions (replace = True )
969+ sql_map = {}
970+ for (_ , info ), sql in zip (self .endpoints .values (), create_sqls ):
971+ sig = info ['signature' ]
972+ sql_map [sig ['name' ]] = sql
973+
967974 for key , (_ , info ) in self .endpoints .items ():
968975 if not func_name or key == func_name :
969976 sig = info ['signature' ]
@@ -1001,8 +1008,12 @@ def get_function_info(
10011008 if a .get ('default' , no_default ) is not no_default :
10021009 returns [- 1 ]['default' ] = a ['default' ]
10031010
1011+ sql = sql_map .get (sig ['name' ], '' )
10041012 functions [sig ['name' ]] = dict (
1005- args = args , returns = returns , function_type = info ['function_type' ],
1013+ args = args ,
1014+ returns = returns ,
1015+ function_type = info ['function_type' ],
1016+ sql_statement = sql ,
10061017 )
10071018
10081019 return functions
You can’t perform that action at this time.
0 commit comments