Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeated Alias #87

Open
edlouth opened this issue Aug 18, 2022 · 1 comment
Open

Repeated Alias #87

edlouth opened this issue Aug 18, 2022 · 1 comment

Comments

@edlouth
Copy link

edlouth commented Aug 18, 2022

I have been following the example here https://metriql.com/tutorial/for-starters

When I run

curl -X POST -H "Content-Type: application/json" -d '{"type": "segmentation", "report": { "dataset": "source_metriql_tpch_customer", "dimensions": ["c_name"], "measures": ["total_rows"]}}'  http://localhost:5656/api/v0/query

I get the following response

{
    "id": "4665b41c-b3c9-4887-bbbe-ffc69bee8e81",
    "startedAt": "2022-08-18T13:46:08.404927Z",
    "duration": 2.968608000,
    "user": "(unknown user)",
    "source": null,
    "status": "failed",
    "update": {
        "state": "FINISHED",
        "info": {
            "reportType": "segmentation",
            "query": {
                "modelName": "source_metriql_tpch_customer",
                "dimensions": [
                    {
                        "name": "c_name",
                        "modelName": "source_metriql_tpch_customer",
                        "relationName": null,
                        "postOperation": null,
                        "pivot": null
                    }
                ],
                "measures": [
                    {
                        "modelName": "source_metriql_tpch_customer",
                        "name": "total_rows",
                        "relationName": null
                    }
                ],
                "filters": null,
                "reportOptions": null,
                "defaultDateRange": null,
                "limit": null,
                "orders": null
            },
            "compiledQuery": "SELECT \n    t1.c_name AS c_name,\n    count(1) AS total_rows\nFROM snowflake_sample_data.tpch_sf1.customer AS t1 AS t1\n\n    GROUP BY\n    1 \n"
        },
        "nodes": 1,
        "percentage": null,
        "elapsedTimeMillis": null,
        "totalBytes": null,
        "processedBytes": null
    },
    "result": {
        "metadata": null,
        "result": null,
        "error": {
            "message": "SQL compilation error:\nsyntax error line 4 at position 51 unexpected 'AS'.",
            "sqlState": "42000",
            "errorCode": 1003,
            "errorLine": null,
            "charPositionInLine": null
        },
        "properties": {
            "limit": 1000,
            "query": "SELECT \n    t1.c_name AS c_name,\n    count(1) AS total_rows\nFROM snowflake_sample_data.tpch_sf1.customer AS t1 AS t1\n\n    GROUP BY\n    1 \n"
        },
        "responseHeaders": null
    }
}

which has two AS t1, hence it show a compliation error.

My schema.yml looks like this

version: 2
sources:
  - name: tpch
    database: snowflake_sample_data
    schema: tpch_sf1
    tables:
      - name: customer
        meta:
          metriql:
            measures:
              total_rows:
                aggregation: count
        columns:
          - name: c_name
            meta:
              metriql.dimension:
                type: string
@buremba
Copy link
Member

buremba commented Aug 24, 2022

Sorry for the delay and thanks for letting you know about the issue. There was a regression in one of the recent versions but it should be fixed now. Can you please try it again by pulling the latest tag from Docker?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants