diff --git a/ibis-server/resources/function_list/bigquery.csv b/ibis-server/resources/function_list/bigquery.csv index fcde88481..e44c70ed5 100644 --- a/ibis-server/resources/function_list/bigquery.csv +++ b/ibis-server/resources/function_list/bigquery.csv @@ -40,3 +40,5 @@ scalar,regexp_contains,boolean,,"text,text","Returns TRUE if value is a partial scalar,datetime,timestamp,,"text","Converts a string to a DATETIME." scalar,datetime_add,datetime,,"datetime,interval","Adds a specified interval to a datetime." scalar,datetime_sub,datetime,,"datetime,interval","Subtracts a specified interval from a datetime." +scalar,date_add,date,,"date,interval","Adds a specified interval to a date." +aggregate,group_concat,string,,"any","(backward compatible)(deprecated) Concatenates multiple strings into a single string, where each value is separated by the optional separator parameter. If separator is omitted, BigQuery returns a comma-separated string. This function has been deprecated in favor of STRING_AGG." diff --git a/ibis-server/resources/function_list/mssql.csv b/ibis-server/resources/function_list/mssql.csv index 04e43a25c..34feedfb4 100644 --- a/ibis-server/resources/function_list/mssql.csv +++ b/ibis-server/resources/function_list/mssql.csv @@ -1,7 +1,11 @@ function_type,name,return_type,param_names,param_types,description -scalar,getdate,Datetime,,,"Returns current date and time." -scalar,getutcdate,Datetime,,,"Returns current UTC date and time." -scalar,sysdatetime,Datetime,,,"Returns date and time of SQL Server." -scalar,host_name,String,,,"Returns workstation name." -scalar,newid,String,,,"Returns new GUID." -scalar,user_name,String,,,"Returns database user name." +scalar,getdate,datetime,,,"Returns current date and time." +scalar,getutcdate,datetime,,,"Returns current UTC date and time." +scalar,sysdatetime,datetime,,,"Returns date and time of SQL Server." +scalar,host_name,string,,,"Returns workstation name." +scalar,newid,string,,,"Returns new GUID." +scalar,user_name,string,,,"Returns database user name." +scalar,isnull,same_as_input,,,"Returns the replacement value if the check_expression is NULL." +scalar,year,integer,,,"Returns an integer that represents the year of the specified date." +scalar,format,string,,,"Returns a value formatted with the specified format and optional culture in SQL Server." +aggregate,group_concat,string,,,"Concatenates values from multiple rows into a single string, with the values separated by a specified separator." \ No newline at end of file diff --git a/ibis-server/resources/white_function_list/bigquery.csv b/ibis-server/resources/white_function_list/bigquery.csv index 8c0d6e68a..d3714c257 100644 --- a/ibis-server/resources/white_function_list/bigquery.csv +++ b/ibis-server/resources/white_function_list/bigquery.csv @@ -177,3 +177,4 @@ scalar,datetime,timestamp,,"text","Converts a string to a DATETIME." scalar,current_timestamp,timestamptz,,"","Returns current timestamp." scalar,datetime_add,datetime,,"datetime,interval","Adds a specified interval to a datetime." scalar,datetime_sub,datetime,,"datetime,interval","Subtracts a specified interval from a datetime." +scalar,date_add,date,,"date,interval","Adds a specified interval to a date." diff --git a/ibis-server/tests/routers/v3/connector/bigquery/test_functions.py b/ibis-server/tests/routers/v3/connector/bigquery/test_functions.py index da909c287..4620a62d7 100644 --- a/ibis-server/tests/routers/v3/connector/bigquery/test_functions.py +++ b/ibis-server/tests/routers/v3/connector/bigquery/test_functions.py @@ -54,7 +54,7 @@ async def test_function_list(client): response = await client.get(url=f"{base_url}/functions") assert response.status_code == 200 result = response.json() - assert len(result) == 178 + assert len(result) == 179 the_func = next( filter( lambda x: x["name"] == "string_agg", diff --git a/ibis-server/tests/routers/v3/connector/mssql/test_functions.py b/ibis-server/tests/routers/v3/connector/mssql/test_functions.py index ec643ec07..b1d081519 100644 --- a/ibis-server/tests/routers/v3/connector/mssql/test_functions.py +++ b/ibis-server/tests/routers/v3/connector/mssql/test_functions.py @@ -53,7 +53,7 @@ async def test_function_list(client): response = await client.get(url=f"{base_url}/functions") assert response.status_code == 200 result = response.json() - assert len(result) == DATAFUSION_FUNCTION_COUNT + 6 + assert len(result) == DATAFUSION_FUNCTION_COUNT + 10 the_func = next(filter(lambda x: x["name"] == "sysdatetime", result)) assert the_func == { "name": "sysdatetime", diff --git a/ibis-server/tools/query_local_run.py b/ibis-server/tools/query_local_run.py index c8b360d8c..72c510931 100644 --- a/ibis-server/tools/query_local_run.py +++ b/ibis-server/tools/query_local_run.py @@ -15,7 +15,7 @@ import json import os from app.custom_sqlglot.dialects.wren import Wren -from app.model import MySqlConnectionInfo, OracleConnectionInfo, PostgresConnectionInfo +from app.model import MSSqlConnectionInfo, MySqlConnectionInfo, OracleConnectionInfo, PostgresConnectionInfo from app.util import to_json import sqlglot import sys @@ -82,7 +82,11 @@ print("# Planned SQL:\n", planned_sql) # Transpile the planned SQL -dialect_sql = sqlglot.transpile(planned_sql, read=Wren, write=data_source)[0] +if data_source == "mssql": + # For mssql, we need to use the "tsql" dialect for reading + dialect_sql = sqlglot.transpile(planned_sql, read=Wren, write="tsql")[0] +else: + dialect_sql = sqlglot.transpile(planned_sql, read=Wren, write=data_source)[0] print("# Dialect SQL:\n", dialect_sql) print("#") @@ -98,6 +102,9 @@ elif data_source == "oracle": connection_info = OracleConnectionInfo.model_validate_json(json.dumps(connection_info)) connection = DataSourceExtension.get_oracle_connection(connection_info) +elif data_source == "mssql": + connection_info = MSSqlConnectionInfo.model_validate_json(json.dumps(connection_info)) + connection = DataSourceExtension.get_mssql_connection(connection_info) else: raise Exception("Unsupported data source:", data_source)