예제 #1
0
 def setUp(self):
   self.client = bigquery_client.BigqueryClient(api='http', api_version='')
   self.reference_tests = {
       'prj:': ('prj', '', ''),
       'example.com:prj': ('example.com:prj', '', ''),
       'example.com:prj-2': ('example.com:prj-2', '', ''),
       'www.example.com:prj': ('www.example.com:prj', '', ''),
       'prj:ds': ('prj', 'ds', ''),
       'example.com:prj:ds': ('example.com:prj', 'ds', ''),
       'prj:ds.tbl': ('prj', 'ds', 'tbl'),
       'example.com:prj:ds.tbl': ('example.com:prj', 'ds', 'tbl'),
       'prefix::example:buganizer.metadata.all': (
           'prefix::example', 'buganizer.metadata', 'all'),
       'prefix.example:buganizer.metadata.all': (
           'prefix.example', 'buganizer.metadata', 'all'),
       'prefix.example:foo_metrics.bar_walkups_sanitised.all': (
           'prefix.example', 'foo_metrics.bar_walkups_sanitised', 'all'),
       }
   self.parse_tests = self.reference_tests.copy()
   self.parse_tests.update({
       'ds.': ('', 'ds', ''),
       'ds.tbl': ('', 'ds', 'tbl'),
       'tbl': ('', '', 'tbl'),
       })
   self.field_names = ('projectId', 'datasetId', 'tableId')
예제 #2
0
 def __init__(self,
              project_id=None,
              logging_file=None,
              cache_max=cfg.CACHE_MAX):
     self.project_id = project_id
     self.logging_file = logging_file
     self.querycache = {}
     self.cache_max = cache_max
     if cache_max is None:
         self.cache_max = cfg.CACHE_MAX
     self.client = bigquery_client.BigqueryClient(api='bigquery',
                                                  api_version='v2')
     self.client.project_id = project_id
     self.client.credentials = bqutil.credentialize()
     http = self.client.credentials.authorize(httplib2.Http())
     self.client._apiclient = bqutil.get_bigquery_api(http)
     self.client._storageclient = bqutil.get_storage_api(http)
예제 #3
0
 def setUp(self):
     self.client = bigquery_client.BigqueryClient(api='http',
                                                  api_version='')
     self.reference_tests = {
         'prj:': ('prj', '', ''),
         'example.com:prj': ('example.com:prj', '', ''),
         'example.com:prj-2': ('example.com:prj-2', '', ''),
         'www.example.com:prj': ('www.example.com:prj', '', ''),
         'prj:ds': ('prj', 'ds', ''),
         'example.com:prj:ds': ('example.com:prj', 'ds', ''),
         'prj:ds.tbl': ('prj', 'ds', 'tbl'),
         'example.com:prj:ds.tbl': ('example.com:prj', 'ds', 'tbl'),
     }
     self.parse_tests = self.reference_tests.copy()
     self.parse_tests.update({
         'ds.': ('', 'ds', ''),
         'ds.tbl': ('', 'ds', 'tbl'),
         'tbl': ('', '', 'tbl'),
     })
     self.field_names = ('projectId', 'datasetId', 'tableId')