Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUG] Translate mssql to tsql in read_sql scan (#2330)
When running `read_sql` against SQL server using a SQL Alchemy connection, for example: ``` connection_url = sqlalchemy.engine.URL.create( "mssql+pyodbc", username=user, password=password, host=host, port=1433, database=database, query={ "driver": "ODBC Driver 18 for SQL Server", }, ) def create_conn(): return sqlalchemy.create_engine(connection_url).connect() df = daft.read_sql("SELECT * FROM test_data", create_conn) ``` The query errors with `Unsupported dialect: mssql, please refer to the documentation for supported dialects`. This is because SQLGlot, the library that read_sql uses for query construction, does not recognize `mssql` as a dialect, it instead recognizes `tsql`, which is the name of the SQL dialect for Microsoft SQL Server: https://learn.microsoft.com/en-us/sql/t-sql/language-reference?view=sql-server-ver16 This PR adds a translation step during sql query construction to fix this issue. NOTE: - This PR was tested locally against a Docker instance of Azure SQL Edge.
- Loading branch information