Skip to content

Conversation

@takbab
Copy link

@takbab takbab commented Jul 21, 2016

Add a field to support BigQuery UDF.
https://cloud.google.com/bigquery/docs/reference/v2/jobs

  • configuration.query.userDefinedFunctionResources[]
  • configuration.query.userDefinedFunctionResources[].inlineCode
  • configuration.query.userDefinedFunctionResources[].resourceUri

(migrated from #1988)

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 21, 2016
reference/v2/jobs#configuration.query.useLegacySql
"""

udf_resources = _TypedProperty(

This comment was marked as spam.

This comment was marked as spam.

@tseaver
Copy link
Contributor

tseaver commented Jul 22, 2016

@takbab I think @dhermes was talking about dropping the use of _TypedProperty in favor of a property implementation which enforces that items in the list are suitable. If we use your class for the items in the list, then the property implementation would look something like:

    @property
    def udf_resources(self):
        """List of user-defined resources.

        :rtype: list of :class:`UdfResource`
        :returns: the list, if set, or None
        """
        return list(self._udf_resources) if self._udf_resources else None

    @udf_resources.setter
    def udf_resources(self, value):
        """Update list of user-defined resources

        :type value: list of :class:`UdfResource`
        :param value: the new list

        :raises: ValueError, ir the items in the list are not all instances of
                 :class:`UdfResource`
        """
        if not all((isinstance(item, UdfResource) for item in value)):
            raise ValueError("pass a list of UdfResource instances")
        self._udf_resources = tuple(value)

@tseaver
Copy link
Contributor

tseaver commented Jul 22, 2016

See #2015 for an alternative.

@dwmclary
Copy link
Contributor

#2015 looks a more like the example from @tseaver but I need to clean up a lint error. What's the advantage to the approach here?

@takbab
Copy link
Author

takbab commented Jul 23, 2016

@tseaver Thanks for the example! I have added the property to QueryJob class.

What can we do?
I just want to use UDF from my app.
#1829

@tseaver
Copy link
Contributor

tseaver commented Jul 27, 2016

@takbab Thanks again for the patch! I merged @dwmclary's version of the feature in #2029, as it looked closer to what I had in mind.

@tseaver tseaver closed this Jul 27, 2016
@takbab
Copy link
Author

takbab commented Jul 28, 2016

I see, thanks!

parthea pushed a commit that referenced this pull request Nov 24, 2025
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants