DEV Community

Marcos Henrique
Marcos Henrique

Posted on

[SOLVED] glue view is stale; it must be re-created

when you facing this annoying error:

'<your-view-name' is stale; it must be re-created
This query ran against the "glue_<yours>_crawler"

power rangers begging for something to stop

In the most cases the solution is simple, despite you barely find solutions on the internet (stackoverflow and some fancy blogs) try just review your columns order on presto metadata, in my case I'm creating the view with aws cdk, so I created a json with my configuration like the following example and then parse this to base64:

{
  "catalog": "awsdatacatalog",
  "schema": "glue_my_crawler",
  "columns": [
    {
      "name": "name",
      "type": "varchar"
    },
    {
      "id": "id",
      "type": "varchar"
    },
  ],
  "originalSql": "SELECT id, name from \"schema-job-result\""
}
Enter fullscreen mode Exit fullscreen mode

The example above results on the:

'<your-view-name' is stale; it must be re-created
This query ran against the "glue_<yours>_crawler"

The correct way is like the example bellow

{
  "catalog": "awsdatacatalog",
  "schema": "glue_my_crawler",
  "columns": [
    {
      "name": "id",
      "type": "varchar"
    },
    {
      "id": "name",
      "type": "varchar"
    },
  ],
  "originalSql": "SELECT id, name from \"schema-job-result\""
}
Enter fullscreen mode Exit fullscreen mode

Barney thumbs up

Top comments (0)