Skip to content

Tesseract engine generating Postgresql dialect queries for MSSQL DBΒ #9567

@UsmanYasin

Description

@UsmanYasin

Describe the bug
While experimenting with Tesseract engine with MSSQL database, I have noted that the queries being generated do not follow T-SQL dialect but are generating PostgreSQL-ish dialect queries

To Reproduce
Steps to reproduce the behavior:

  1. Start cube.dev with a test data model
  2. Select a column to query and check the generated SQL. The generated SQL is following T-SQL dialect and runs fine.
  3. Enable Tesseract engine by setting the env variable true and restart cube.dev
  4. Select a column to query and check the generated SQL. The generated SQL is following postgresql dialect and fails to run on mssql.

Expected behavior
Tesseract should generate SQL based on the dialect of the underlying DBMS just as cube.dev generates queries based on the DBMS dialect when Tesseract is not being used.

Screenshots
Without Tesseract:

Image

With Tesseract:

Image

Minimally reproducible Cube Schema
In case your bug report is data modelling related please put your minimally reproducible Cube Schema here.
You can use selects without tables in order to achieve that as follows.

cube(`TestModel`, {
    sql: `
    select 'Europe' as Continent, 'Germany' as  Country
    UNION ALL
    select 'Europe' as Continent, 'France' as  Country
    UNION ALL
    select 'Europe' as Continent, 'Norway' as  Country
    UNION ALL
    select 'Asia' as Continent, 'China' as  Country
    UNION ALL
    select 'Asia' as Continent, 'Singapore' as  Country
    `,
    measures: {
      count: {
        type: `count`,
      },
    },
    dimensions: {
      continent: {
        sql: `Continent`,
        type: `string`,
      },
      country: {
        sql: `Country`,
        type: `string`,
      },
    },
  });

Version:
1.3.14

Additional context
N/A

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions