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
--# :down | |
DROP FUNCTION IF EXISTS jsonb_object_to_property_bag(jsonb, text, text) | |
; | |
--# | |
--# :up | |
CREATE FUNCTION jsonb_object_to_property_bag(jsonb, text = 'key', text = 'value') |
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
WITH _data AS | |
( | |
SELECT | |
* | |
,EXTRACT(YEAR FROM invoice_date + INTERVAL '3 MONTHS') AS season | |
FROM public.dcp_sales_log | |
) | |
,_new AS | |
( | |
SELECT |
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
name: Example Strategy | |
strategy: base_acre | |
geography: &geography | |
include: | |
states: | |
AR: all_counties | |
LA: all_counties | |
MS: all_counties |
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
sort -uf \ | |
<(cut -d'|' -f2 growers_20150608.txt) \ | |
<(cut -d'|' -f3 growers_20150608.txt) \ | |
>! names.txt |
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
USE usga_apps; | |
GO | |
TRUNCATE TABLE seer.forecasts; | |
GO | |
INSERT INTO seer.forecasts | |
SELECT * | |
FROM USGAPROD2.usga_apps.seer.forecasts f | |
WHERE EXISTS |
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
DECLARE @forecast_snapshot_id uniqueidentifier = '54266D12-8B13-4C23-9BDF-A740580ECFB2'; | |
WITH _sources AS | |
( | |
SELECT | |
CASE | |
WHEN source LIKE 'MB[QL]%' | |
THEN LEFT(source, 7) | |
ELSE LEFT(source, 9) | |
END AS label |
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
begin; | |
/* | |
Problem: I don't want the application to really care about how the data is | |
structured in the database. The application / view code needs to work | |
with the data in a sane format, without worrying about normalization, joins, | |
eager fetching, etc. | |
DB Schema Overview: | |
orders |
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
| |
---------------------------------------------------------------- | |
Sourcing data from facts.memberships for Dec 2010 | |
Sourcing data from facts.memberships for Dec 2009 | |
Payment Month # Pmts Payment $ Avg Pmt $ Reg Pmt $ Def Pmt $ % Def $ | |
------------- ------- ---------- ---------- ---------- ---------- -------- | |
Dec 2009 77993 2229775 28.59 2162510 67255 0.03016 | |
Dec 2010 81479 2284552 28.04 2206707 77845 0.03407 |
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
| |
---------------------------------------------------------------- | |
Sourcing data from facts.memberships for Nov 2011 | |
Sourcing data from facts.memberships for Nov 2010 | |
Payment Month # Pmts Payment $ Avg Pmt $ Reg Pmt $ Def Pmt $ % Def $ | |
------------- ------- ---------- ---------- ---------- ---------- -------- | |
Nov 2010 32171 1186334 36.88 290652 895682 0.75500 | |
Nov 2011 28318 1054941 37.25 231613 823328 0.78045 |
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
| |
---------------------------------------------------------------- | |
Sourcing data from facts.memberships for Oct 2011 | |
Sourcing data from facts.memberships for Oct 2010 | |
Payment Month # Pmts Payment $ Avg Pmt $ Reg Pmt $ Def Pmt $ % Def $ | |
------------- ------- ---------- ---------- ---------- ---------- -------- | |
Oct 2010 34017 1313515 38.61 425800 887715 0.67583 | |
Oct 2011 35298 1278274 36.21 441042 837232 0.65497 |
NewerOlder