google-bigquery

ST_MAKELINE discarding duplicate points even if not consecutive

梦想的初衷 提交于 2020-03-04 23:24:46
问题 Consider this simplified example: SELECT ST_MAKELINE([ ST_GEOGPOINT(5, 51), ST_GEOGPOINT(5, 52), ST_GEOGPOINT(5, 51) ]) I would expect this to construct a line with three points, that doubles back on itself. Instead, what I'm getting is: LINESTRING(5 51, 5 52) It seems that BigQuery is discarding duplicate points, even if they are not consecutive. This is messing up my distance calculation, which involves taking the ST_LENGTH of the resulting linestring. As a workaround, I'm constructing a

ST_MAKELINE discarding duplicate points even if not consecutive

本小妞迷上赌 提交于 2020-03-04 23:23:25
问题 Consider this simplified example: SELECT ST_MAKELINE([ ST_GEOGPOINT(5, 51), ST_GEOGPOINT(5, 52), ST_GEOGPOINT(5, 51) ]) I would expect this to construct a line with three points, that doubles back on itself. Instead, what I'm getting is: LINESTRING(5 51, 5 52) It seems that BigQuery is discarding duplicate points, even if they are not consecutive. This is messing up my distance calculation, which involves taking the ST_LENGTH of the resulting linestring. As a workaround, I'm constructing a

ST_MAKELINE discarding duplicate points even if not consecutive

我们两清 提交于 2020-03-04 23:21:35
问题 Consider this simplified example: SELECT ST_MAKELINE([ ST_GEOGPOINT(5, 51), ST_GEOGPOINT(5, 52), ST_GEOGPOINT(5, 51) ]) I would expect this to construct a line with three points, that doubles back on itself. Instead, what I'm getting is: LINESTRING(5 51, 5 52) It seems that BigQuery is discarding duplicate points, even if they are not consecutive. This is messing up my distance calculation, which involves taking the ST_LENGTH of the resulting linestring. As a workaround, I'm constructing a

ST_MAKELINE discarding duplicate points even if not consecutive

白昼怎懂夜的黑 提交于 2020-03-04 23:21:32
问题 Consider this simplified example: SELECT ST_MAKELINE([ ST_GEOGPOINT(5, 51), ST_GEOGPOINT(5, 52), ST_GEOGPOINT(5, 51) ]) I would expect this to construct a line with three points, that doubles back on itself. Instead, what I'm getting is: LINESTRING(5 51, 5 52) It seems that BigQuery is discarding duplicate points, even if they are not consecutive. This is messing up my distance calculation, which involves taking the ST_LENGTH of the resulting linestring. As a workaround, I'm constructing a

Downloading table data as CSV to local machine in Big query

随声附和 提交于 2020-03-04 04:39:09
问题 def downloadGbqToCsv(self,table_name,csv): credentials = GoogleCredentials.get_application_default() bigquery = discovery.build('bigquery', 'v2', credentials=credentials) job_data = { 'sourceTable': { 'projectId': self.project_id, 'datasetId': self.dataset_id, 'tableId': table_name, }, 'destinationUris': 'path/to/download', 'destinationFormat': 'CSV', 'compression': 'NONE' } start = time.time() job_id = 'job_%d' % start # Create the job. result = bigquery.jobs().insert(projectId=self.project

How do I get usage data about the what views and datasets are being used/queried in BigQuery?

不打扰是莪最后的温柔 提交于 2020-03-03 16:34:54
问题 I need usage data on the dataset and views in BigQuery. I want a count of how many queries were ran against all the different datasets and views. My goal is to understand what datasets and views are currently being used. I looked in the Audit Log, however I'm not able to export all the records into excel for analysis. I am only able to export max 300 logs for a specific day. Is there a way to run a query in BigQuery that will give me this data instead of exporting from the Audit Log? 回答1: Yes

How do I get usage data about the what views and datasets are being used/queried in BigQuery?

流过昼夜 提交于 2020-03-03 16:33:32
问题 I need usage data on the dataset and views in BigQuery. I want a count of how many queries were ran against all the different datasets and views. My goal is to understand what datasets and views are currently being used. I looked in the Audit Log, however I'm not able to export all the records into excel for analysis. I am only able to export max 300 logs for a specific day. Is there a way to run a query in BigQuery that will give me this data instead of exporting from the Audit Log? 回答1: Yes

running async JS functions on BigQuery with #standardSQL

ぐ巨炮叔叔 提交于 2020-03-01 18:35:16
问题 Now that BigQuery supports async on #standardSQL, how can I convert this #legacySQL function to run on #standardSQL? #legacySQL SELECT SUM(s) FROM js(( SELECT FLOOR(RAND()*100000) group, NEST(requests) as x FROM ( SELECT requests, content_size FROM [fh-bigquery:wikipedia.pagecounts_201205] ) GROUP BY group) , group, x , "[{name:'s', type: 'float'}]", "function (row, emit) { const memory = new WebAssembly.Memory({ initial: 256, maximum: 256 }); const env = { 'abortStackOverflow': _ => { throw

Check and map IP address to subnet lookup table with SQL

ε祈祈猫儿з 提交于 2020-03-01 04:35:54
问题 I have a table that shows IP addresses assigned to equipment belonging to a customer. This table is used to measure user's activity and performance and generated on a regular basis. I would like to map the IP addresses of these customers to customer ID or name. Due to size and multiple IP addresses that can be assigned to the same customer we have to use subnet instead of individual IP addresses. The report table contains an IPaddress field and the subnet mapping table is something like below

Check and map IP address to subnet lookup table with SQL

这一生的挚爱 提交于 2020-03-01 04:35:45
问题 I have a table that shows IP addresses assigned to equipment belonging to a customer. This table is used to measure user's activity and performance and generated on a regular basis. I would like to map the IP addresses of these customers to customer ID or name. Due to size and multiple IP addresses that can be assigned to the same customer we have to use subnet instead of individual IP addresses. The report table contains an IPaddress field and the subnet mapping table is something like below