Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ibis-server/resources/function_list/bigquery.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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."
16 changes: 10 additions & 6 deletions ibis-server/resources/function_list/mssql.csv
Original file line number Diff line number Diff line change
@@ -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."
1 change: 1 addition & 0 deletions ibis-server/resources/white_function_list/bigquery.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 9 additions & 2 deletions ibis-server/tools/query_local_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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("#")

Expand All @@ -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)

Expand Down
Loading