Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Dataform CompilationResult does not return a compilationErrors property

So I have a file with a syntax error like this (The change is committed but I have not pushed it):

 

/* 
Template file 
*/ 
SELECTT 1

 

But when I make an API Rest request to compilationResults.create does return a CompilationResult but without the compilationErrors property. I'm sending the workspace name on the request body, so the response is something like this:

 

 

{
  "data": {
    "name": "projects/my-project/locations/us-central1/repositories/DataWarehouse/compilationResults/asd123",
    "workspace": "projects/projectID/locations/us-central1/repositories/DataWarehouse/workspaces/workspacename",
    "codeCompilationConfig": {
      "defaultDatabase": "my-project",
      "defaultSchema": "dp_df",
      "assertionSchema": "dataform_assertions",
      "vars": {
        // Here shows the workspace vars
      },
      "defaultLocation": "US"
    },
    "dataformCoreVersion": "2.4.2",
    "createTime": "2024-09-25T11:00:48.354272708Z"
  }

 

any clue of what could be happening? Already tried so many things, the property never shows up

0 2 133
2 REPLIES 2

Hi @joans544,

Welcome to Google Cloud Community!

The compilationErrors property isn't included in the initial response from compilationResults.create because the compilation process operates asynchronously.

To retrieve the compilationErrors, you'll need to periodically check the compilation status using the compilationResults.get endpoint, providing the name you received in the initial response. Once the compilation is complete, this endpoint will provide the error details or an empty array if the compilation was successful.

I hope the above information is helpful.

Thanks for you reply.

Forgot to mention that I'm using the compilationResults.get to retrieve the results.

After checking again, seems like only Javascript Syntax errors are checked, not SQL syntax errors. I'll work with that for now, but would be better if I could check for SQL syntax errors.