Repository: googleapis/google-cloud-python

Issue:
Call for comments: Python 2.6 support will be dropped August 1, 2016
Anyone who thinks they still need Python 2.6, please speak up here. (Sorry there isn't a better channel.)

Relates to #995 

/cc @tseaver @jgeewax



Discussion:
I am :+1: to dropping support for Python 2.6.... If they aren't making security fixes, it's kind of irresponsible for us to continue enabling it....

I'm [already on record as in favor of dropping 2.6 support](https://github.com/GoogleCloudPlatform/gcloud-python/issues/995#issuecomment-122983016).


Resolving patch:
diff --git a/gcloud/bigquery/job.py b/gcloud/bigquery/job.py
--- a/gcloud/bigquery/job.py
+++ b/gcloud/bigquery/job.py
@@ -869,6 +869,7 @@ class _AsyncQueryConfiguration(object):
     _flatten_results = None
     _priority = None
     _use_query_cache = None
+    _use_legacy_sql = None
     _write_disposition = None
 
 
@@ -927,6 +928,12 @@ def __init__(self, name, query, client):
     https://cloud.google.com/bigquery/docs/reference/v2/jobs#configuration.query.useQueryCache
     """
 
+    use_legacy_sql = _TypedProperty('use_legacy_sql', bool)
+    """See:
+    https://cloud.google.com/bigquery/docs/\
+    reference/v2/jobs#configuration.query.useLegacySql
+    """
+
     write_disposition = WriteDisposition('write_disposition')
     """See:
     https://cloud.google.com/bigquery/docs/reference/v2/jobs#configuration.query.writeDisposition
@@ -965,6 +972,8 @@ def _populate_config_resource(self, configuration):
             configuration['priority'] = self.priority
         if self.use_query_cache is not None:
             configuration['useQueryCache'] = self.use_query_cache
+        if self.use_legacy_sql is not None:
+            configuration['useLegacySql'] = self.use_legacy_sql
         if self.write_disposition is not None:
             configuration['writeDisposition'] = self.write_disposition
 
diff --git a/gcloud/bigquery/query.py b/gcloud/bigquery/query.py
--- a/gcloud/bigquery/query.py
+++ b/gcloud/bigquery/query.py
@@ -34,6 +34,7 @@ class _SyncQueryConfiguration(object):
     _timeout_ms = None
     _preserve_nulls = None
     _use_query_cache = None
+    _use_legacy_sql = None
 
 
 class QueryResults(object):
@@ -233,6 +234,12 @@ def schema(self):
     https://cloud.google.com/bigquery/docs/reference/v2/jobs/query#useQueryCache
     """
 
+    use_legacy_sql = _TypedProperty('use_legacy_sql', bool)
+    """See:
+    https://cloud.google.com/bigquery/docs/\
+    reference/v2/jobs/query#useLegacySql
+    """
+
     def _set_properties(self, api_response):
         """Update properties from resource in body of ``api_response``
 
@@ -264,6 +271,9 @@ def _build_resource(self):
         if self.use_query_cache is not None:
             resource['useQueryCache'] = self.use_query_cache
 
+        if self.use_legacy_sql is not None:
+            resource['useLegacySql'] = self.use_legacy_sql
+
         if self.dry_run is not None:
             resource['dryRun'] = self.dry_run
 


Test patch:
diff --git a/gcloud/bigquery/test_job.py b/gcloud/bigquery/test_job.py
--- a/gcloud/bigquery/test_job.py
+++ b/gcloud/bigquery/test_job.py
@@ -1248,6 +1248,11 @@ def _verifyBooleanResourceProperties(self, job, config):
                              config['useQueryCache'])
         else:
             self.assertTrue(job.use_query_cache is None)
+        if 'useLegacySql' in config:
+            self.assertEqual(job.use_legacy_sql,
+                             config['useLegacySql'])
+        else:
+            self.assertTrue(job.use_legacy_sql is None)
 
     def _verifyResourceProperties(self, job, resource):
         self._verifyReadonlyResourceProperties(job, resource)
@@ -1310,6 +1315,7 @@ def test_ctor(self):
         self.assertTrue(job.flatten_results is None)
         self.assertTrue(job.priority is None)
         self.assertTrue(job.use_query_cache is None)
+        self.assertTrue(job.use_legacy_sql is None)
         self.assertTrue(job.write_disposition is None)
 
     def test_from_api_repr_missing_identity(self):
@@ -1420,6 +1426,7 @@ def test_begin_w_alternate_client(self):
             'flattenResults': True,
             'priority': 'INTERACTIVE',
             'useQueryCache': True,
+            'useLegacySql': True,
             'writeDisposition': 'WRITE_TRUNCATE',
         }
         RESOURCE['configuration']['query'] = QUERY_CONFIGURATION
@@ -1439,6 +1446,7 @@ def test_begin_w_alternate_client(self):
         job.flatten_results = True
         job.priority = 'INTERACTIVE'
         job.use_query_cache = True
+        job.use_legacy_sql = True
         job.write_disposition = 'WRITE_TRUNCATE'
 
         job.begin(client=client2)
diff --git a/gcloud/bigquery/test_query.py b/gcloud/bigquery/test_query.py
--- a/gcloud/bigquery/test_query.py
+++ b/gcloud/bigquery/test_query.py
@@ -136,6 +136,7 @@ def test_ctor(self):
         self.assertTrue(query.max_results is None)
         self.assertTrue(query.preserve_nulls is None)
         self.assertTrue(query.use_query_cache is None)
+        self.assertTrue(query.use_legacy_sql is None)
 
     def test_job_wo_jobid(self):
         client = _Client(self.PROJECT)
@@ -206,6 +207,7 @@ def test_run_w_alternate_client(self):
         query.preserve_nulls = True
         query.timeout_ms = 20000
         query.use_query_cache = False
+        query.use_legacy_sql = True
         query.dry_run = True
 
         query.run(client=client2)
@@ -226,6 +228,7 @@ def test_run_w_alternate_client(self):
             'preserveNulls': True,
             'timeoutMs': 20000,
             'useQueryCache': False,
+            'useLegacySql': True,
         }
         self.assertEqual(req['data'], SENT)
         self._verifyResourceProperties(query, RESOURCE)