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

google_bigquery_job resource ignores use_legacy_sql=false flag #6231

Closed
YuriiYashchenko opened this issue Apr 28, 2020 · 4 comments
Closed
Assignees
Labels

Comments

@YuriiYashchenko
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.

Terraform Version

Terraform v0.12.18

  • provider.google v3.19.0
  • provider.google-beta v3.19.0

Affected Resource(s)

google_bigquery_job

Terraform Configuration Files

resource "google_bigquery_job" "job" {
  project = data.google_project.current-project.project_id
  job_id  = "n"
  query {
    query          = "SELECT Id FROM n.Some_view"
    use_legacy_sql = false
  }
}

Debug Output

Panic Output

Expected Behavior

Big Query job uses Standard SQL dialect. Use Legacy SQL should be false.

Actual Behavior

Big Query job uses Legacy SQL dialect. Use legacy SQL is true.

Steps to Reproduce

  1. terraform apply

Important Factoids

References

  • #0000
@ghost ghost added the bug label Apr 28, 2020
@venkykuberan venkykuberan self-assigned this Apr 28, 2020
@venkykuberan
Copy link
Contributor

Unless you set to false, provider submit the request with default value true to API. Provider can't validate the type of SQL being sent and also i see API sending back the response with useLegacySql=true for the standard SQL request. As provider is working as expected i am closing this issue. Please reopen if you feel otherwise.

Terraform config

resource "google_bigquery_job" "job" {
  project = var.project_id
  provider = google-beta
  job_id  = "n23"
  query {
    query          = "SELECT * FROM test_dataset.summary LIMIT 1000"
    # use_legacy_sql = false
  }
}

sample partial API response just for reference

"configuration": {
     "query": {
       "query": "SELECT * FROM test_dataset.summary LIMIT 1000",
       "destinationTable": {
         "projectId": "xx-xxx-xx",
         "datasetId": "_de49512d56391c1a7038eb1234343d4df786266f",
         "tableId": "anonff88a2d1b0eb23db4e95c8f1b2032432cb5befee"
       },
       "createDisposition": "CREATE_IF_NEEDED",
       "writeDisposition": "WRITE_TRUNCATE",
       "priority": "INTERACTIVE",
       "useQueryCache": true,
       "useLegacySql": true
     },
     "jobType": "QUERY"
   }

@YuriiYashchenko
Copy link
Author

Unless you set to false, provider submit the request with default value true to API. Provider can't validate the type of SQL being sent and also i see API sending back the response with useLegacySql=true for the standard SQL request. As provider is working as expected i am closing this issue. Please reopen if you feel otherwise.

Terraform config

resource "google_bigquery_job" "job" {
  project = var.project_id
  provider = google-beta
  job_id  = "n23"
  query {
    query          = "SELECT * FROM test_dataset.summary LIMIT 1000"
    # use_legacy_sql = false
  }
}

sample partial API response just for reference

"configuration": {
     "query": {
       "query": "SELECT * FROM test_dataset.summary LIMIT 1000",
       "destinationTable": {
         "projectId": "xx-xxx-xx",
         "datasetId": "_de49512d56391c1a7038eb1234343d4df786266f",
         "tableId": "anonff88a2d1b0eb23db4e95c8f1b2032432cb5befee"
       },
       "createDisposition": "CREATE_IF_NEEDED",
       "writeDisposition": "WRITE_TRUNCATE",
       "priority": "INTERACTIVE",
       "useQueryCache": true,
       "useLegacySql": true
     },
     "jobType": "QUERY"
   }

Everything works correctly when we use Legacy SQL dialect. But when I set use_legacy_sql = false to create a job with Standard SQL dialect it doesn't change dialect of result job. Created BQ job always has "Use legacy SQL" = false.

@YuriiYashchenko YuriiYashchenko changed the title google_bigquery_job resource ignores use_legacy_sql flag google_bigquery_job resource ignores use_legacy_sql=false flag May 2, 2020
@YuriiYashchenko
Copy link
Author

@venkykuberan I think the issue should be reopened because setting use_legacy_sql=false doesn't affect the BQ job.

@ghost
Copy link

ghost commented May 29, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators May 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants