Skip to content

Instantly share code, notes, and snippets.

View ebendutoit's full-sized avatar
:octocat:

Eben du Toit ebendutoit

:octocat:
View GitHub Profile
@ebendutoit
ebendutoit / bigquery_result_transform.js
Last active September 25, 2020 13:16
Tranforming BigQuery query json results into a flattened version that's easier to use
View bigquery_result_transform.js
convertBQToMySQLResults(schema, rows) {
var resultRows = []
function recurse (schemaCur, rowsCur, colName) {
if (Array.isArray(schemaCur) && !Array.isArray(result[colName])) {
for(var i=0, l=schemaCur.length; i<l; i++) {
if (colName === "")
recurse(schemaCur[i], rowsCur.f[i], colName + schemaCur[i].name)
@ebendutoit
ebendutoit / flattened_bigquery_result.json
Last active March 25, 2019 13:53
Flattened BigQuery result
View flattened_bigquery_result.json
{
"Name": "Peter",
"Address" : [
{ "Address.street": "street1", "Address.city": "city1" },
{ "Address.street": "street2", "Address.city": "city2" }
]
}
@ebendutoit
ebendutoit / bigquery_json_result.json
Created March 25, 2019 07:23
BigQuery schema and rows result
View bigquery_json_result.json
{
"schema": {
"fields": [
{
"name": "Name",
"type": "STRING",
"mode": "NULLABLE"
},
{
"name": "Address",
@ebendutoit
ebendutoit / blockchainid.txt
Created August 27, 2015 19:28
Verifying that +eebsidian is my blockchain ID. https://onename.com/eebsidian
View blockchainid.txt
Verifying that +eebsidian is my blockchain ID. https://onename.com/eebsidian