Skip to content

Commit 1ff3252

Browse files
author
dwmclary
committed
started addding udf resources
1 parent a316dd6 commit 1ff3252

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

gcloud/bigquery/query.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
from gcloud.bigquery.job import QueryJob
2323
from gcloud.bigquery.table import _parse_schema_resource
2424

25-
2625
class _SyncQueryConfiguration(object):
2726
"""User-settable configuration options for synchronous query jobs.
2827
@@ -35,7 +34,26 @@ class _SyncQueryConfiguration(object):
3534
_preserve_nulls = None
3635
_use_query_cache = None
3736
_use_legacy_sql = None
38-
37+
38+
class userDefinedFunctionResource(object):
39+
"""Describe a single user-defined function (UDF) resource.
40+
See
41+
https://cloud.google.com/bigquery/user-defined-functions#api
42+
43+
:type udfType: str
44+
:param udfType: the type of the resource (one of 'inlineCode' or 'resourceUri')
45+
46+
:type value: str
47+
:param value: the inline code or resource URI
48+
"""
49+
def __init__(self, udfType, value):
50+
self.udfType = udfType
51+
self.value = value
52+
53+
def __eq__(self, other):
54+
return(
55+
self.udfType == other.udfType and
56+
self.value == other.value)
3957

4058
class QueryResults(object):
4159
"""Synchronous job: query tables.
@@ -239,6 +257,8 @@ def schema(self):
239257
https://cloud.google.com/bigquery/docs/\
240258
reference/v2/jobs/query#useLegacySql
241259
"""
260+
261+
242262

243263
def _set_properties(self, api_response):
244264
"""Update properties from resource in body of ``api_response``
@@ -279,6 +299,7 @@ def _build_resource(self):
279299

280300
return resource
281301

302+
282303
def run(self, client=None):
283304
"""API call: run the query via a POST request
284305

0 commit comments

Comments
 (0)