Skip to content

Clickhouse: Error: Failed to parse '(= toYYYYMM(time))' #5234

Open

Description

@andness

I've hit this error from the sqlmesh run command in our staging environment, but I've also hit it at various times during development. After asking about it on Slack I was asked to see if I could reproduce. The full error is

Error: Failed to parse '(= toYYYYMM(time))' into <class 'sqlglot.expressions.PartitionedByProperty'>

I was planning to reproduce the uv run error, but since the model is INCREMENTAL_BY_TIME_RANGE the cron prevented me from using sqlmesh run. I decided to use sqlmesh destroy to start over, and that's when I hit it.

So here's what I did:

  1. Init a new sqlmesh project with the clickhouse dialect
  2. Add a single model
  3. Successfully run plan

The model contains this line:

  partitioned_by = toYYYYMM(time),

As far as I can tell this line is wrong, the correct syntax is:

  partitioned_by toYYYYMM(time),

i.e. without the =

But somehow it still gets past plan and presumably makes it into some kind of state as I'm now unable to destroy the project.

The project is now in this state locally, so if you have some instructions for what I should pull out I'll be happy to do that.

Activity

  1. andness commented on Aug 27, 2025

    @andness
    Author

    I can confirm that after executing this:

    update _snapshots set snapshot = replace(snapshot, '= toYYYYMM(time)', 'toYYYYMM(time)') where version = '3230686174';
    

    The destroy command runs. So the problem seems to be the sql text stored in the _snapshots table.

  2. added
    Bug
    Engine: Clickhouse
    on Aug 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugEngine: Clickhouse

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions