Ejemplo n.º 1
0
    def _populate_config_resource(self, configuration):
        """Helper for _build_resource: copy config properties to resource"""
        self._populate_config_resource_booleans(configuration)

        if self.create_disposition is not None:
            configuration['createDisposition'] = self.create_disposition
        if self.default_dataset is not None:
            configuration['defaultDataset'] = {
                'projectId': self.default_dataset.project,
                'datasetId': self.default_dataset.name,
            }
        if self.destination is not None:
            table_res = self._destination_table_resource()
            configuration['destinationTable'] = table_res
        if self.priority is not None:
            configuration['priority'] = self.priority
        if self.write_disposition is not None:
            configuration['writeDisposition'] = self.write_disposition
        if self.maximum_billing_tier is not None:
            configuration['maximumBillingTier'] = self.maximum_billing_tier
        if self.maximum_bytes_billed is not None:
            configuration['maximumBytesBilled'] = self.maximum_bytes_billed
        if len(self._udf_resources) > 0:
            configuration[self._UDF_KEY] = _build_udf_resources(
                self._udf_resources)
Ejemplo n.º 2
0
    def _build_resource(self):
        """Generate a resource for :meth:`begin`."""
        resource = {'query': self.query}

        if self.default_dataset is not None:
            resource['defaultDataset'] = {
                'projectId': self.project,
                'datasetId': self.default_dataset.name,
            }

        if self.max_results is not None:
            resource['maxResults'] = self.max_results

        if self.preserve_nulls is not None:
            resource['preserveNulls'] = self.preserve_nulls

        if self.timeout_ms is not None:
            resource['timeoutMs'] = self.timeout_ms

        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

        if len(self._udf_resources) > 0:
            resource[self._UDF_KEY] = _build_udf_resources(self._udf_resources)

        return resource
Ejemplo n.º 3
0
    def _build_resource(self):
        """Generate a resource for :meth:`begin`."""
        resource = {'query': self.query}

        if self.default_dataset is not None:
            resource['defaultDataset'] = {
                'projectId': self.project,
                'datasetId': self.default_dataset.name,
            }

        if self.max_results is not None:
            resource['maxResults'] = self.max_results

        if self.preserve_nulls is not None:
            resource['preserveNulls'] = self.preserve_nulls

        if self.timeout_ms is not None:
            resource['timeoutMs'] = self.timeout_ms

        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

        if len(self._udf_resources) > 0:
            resource[self._UDF_KEY] = _build_udf_resources(self._udf_resources)

        return resource
Ejemplo n.º 4
0
 def _populate_config_resource(self, configuration):
     """Helper for _build_resource: copy config properties to resource"""
     if self.allow_large_results is not None:
         configuration['allowLargeResults'] = self.allow_large_results
     if self.create_disposition is not None:
         configuration['createDisposition'] = self.create_disposition
     if self.default_dataset is not None:
         configuration['defaultDataset'] = {
             'projectId': self.default_dataset.project,
             'datasetId': self.default_dataset.name,
         }
     if self.destination is not None:
         table_res = self._destination_table_resource()
         configuration['destinationTable'] = table_res
     if self.flatten_results is not None:
         configuration['flattenResults'] = self.flatten_results
     if self.priority is not None:
         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
     if self.maximum_billing_tier is not None:
         configuration['maximumBillingTier'] = self.maximum_billing_tier
     if self.maximum_bytes_billed is not None:
         configuration['maximumBytesBilled'] = self.maximum_bytes_billed
     if len(self._udf_resources) > 0:
         configuration[self._UDF_KEY] = _build_udf_resources(
             self._udf_resources)
Ejemplo n.º 5
0
    def _populate_config_resource(self, configuration):
        """Helper for _build_resource: copy config properties to resource"""
        self._populate_config_resource_booleans(configuration)

        if self.create_disposition is not None:
            configuration['createDisposition'] = self.create_disposition
        if self.default_dataset is not None:
            configuration['defaultDataset'] = {
                'projectId': self.default_dataset.project,
                'datasetId': self.default_dataset.name,
            }
        if self.destination is not None:
            table_res = self._destination_table_resource()
            configuration['destinationTable'] = table_res
        if self.priority is not None:
            configuration['priority'] = self.priority
        if self.write_disposition is not None:
            configuration['writeDisposition'] = self.write_disposition
        if self.maximum_billing_tier is not None:
            configuration['maximumBillingTier'] = self.maximum_billing_tier
        if self.maximum_bytes_billed is not None:
            configuration['maximumBytesBilled'] = self.maximum_bytes_billed
        if len(self._udf_resources) > 0:
            configuration[self._UDF_KEY] = _build_udf_resources(
                self._udf_resources)
Ejemplo n.º 6
0
 def _populate_config_resource(self, configuration):
     """Helper for _build_resource: copy config properties to resource"""
     if self.allow_large_results is not None:
         configuration['allowLargeResults'] = self.allow_large_results
     if self.create_disposition is not None:
         configuration['createDisposition'] = self.create_disposition
     if self.default_dataset is not None:
         configuration['defaultDataset'] = {
             'projectId': self.default_dataset.project,
             'datasetId': self.default_dataset.name,
         }
     if self.destination is not None:
         table_res = self._destination_table_resource()
         configuration['destinationTable'] = table_res
     if self.flatten_results is not None:
         configuration['flattenResults'] = self.flatten_results
     if self.priority is not None:
         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
     if self.maximum_billing_tier is not None:
         configuration['maximumBillingTier'] = self.maximum_billing_tier
     if self.maximum_bytes_billed is not None:
         configuration['maximumBytesBilled'] = self.maximum_bytes_billed
     if len(self._udf_resources) > 0:
         configuration[self._UDF_KEY] = _build_udf_resources(
             self._udf_resources)