This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
import requests_cache | |
import datetime | |
requests_cache.install_cache('blood_cache') | |
def get_drives(): | |
headers = { | |
'content-type': 'application/json' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
division_info->>'division_id' AS id, | |
division_info->>'division_name' AS name, | |
division_info->>'division_lead' AS lead | |
FROM | |
company_divisions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO company_regions | |
SELECT * | |
FROM json_populate_record(NULL::company_regions, | |
'{"region_id":"10","company_regions":"British Columbia","country":"Canada"}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO company_regions | |
SELECT * | |
FROM json_populate_record(NULL::company_regions, | |
'{"region_id":"10","company_regions":"British Columbia","country":"Canada"}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%time | |
%%sql | |
WITH | |
-- # compute application statistics, MAU and percent change in MAU. | |
appStats AS | |
( | |
SELECT | |
rows.r[2][1]."name" AS app, |