Sitelet https://github.com/googleapis/google-cloud-java/issues/1257
Skip to content

Bug: BigQuery: Need a way to set JobId... #1257

Description

@lesv

There doesn't appear to be a way to set the JobId, making cancel(String JobiD) challenging.

Looking at Python L35, The query Job takes a JobId. There doesn't appear to be a similar method for Java. ;(

    client = bigquery.Client()
    query_job = client.run_async_query(str(uuid.uuid4()), query)
    query_job.use_legacy_sql = False
    query_job.begin()

Activity

  1. added
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    api: bigqueryIssues related to the BigQuery API.
    on Sep 16, 2016
  2. lesv commented on Sep 16, 2016

    @lesv
    ContributorAuthor
  3. mziccard commented on Sep 16, 2016

    @mziccard
    Contributor

    There doesn't appear to be a way to set the JobId

    Where? and why is cancel challenging?

  4. lesv commented on Sep 17, 2016

    @lesv
    ContributorAuthor

    Tim's explanation of the string variant of cancel(String "id") is that it is a name provided by the user on create, in the case of the Python samples a UUID. The .jobId() is the other kind. If you can't ever set / create with a name/id, then what's the point of the string method?

    I presume, I could perhaps, use .jobId().toString(), in the snippets, but that just seems weird.

    It's also terribly possible that I'm not understanding something, but Tim couldn't find it either, and wrote another issue for it.

  5. mziccard commented on Sep 17, 2016

    @mziccard
    Contributor

    But you can create a job passing your own name:

    String jobName = "my_job";
    JobInfo jobInfo = JobInfo.of(JobId.of(jobName), QueryJobConfiguration.of("SELECT * FROM table"));
  6. added a commit that references this issue on Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the BigQuery API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions