Useful Commands

You can click on the text below, modify it and then copy to use for your command. That won't change the original content.


Create a quick table using Presto
CREATE TABLE rsvtest01
as 
select 1 as uid, 'John' as fname union all
select 2 as uid, 'Mary' as fname union all
select 3 as uid, 'Sean' as fname union all
select 4 as uid, 'Bobb' as fname
;

Create a table with array element
CREATE TABLE rsvtest05
as 
select 1 as uid, ARRAY [1, 2] as arr1 union all
select 2 as uid, ARRAY [10, 20] as arr1 union all
select 3 as uid, ARRAY [100, 200] as arr1 
;
			  
./status --tree tasks/platform/ad_network/audience_network_core_metrics.py  
			  
./nbackfill -ts platform.ad_network.audience_network_core_metrics.load_fct_mobile_ads_network_metrics -s 2016-07-12 -l -b rsvtest0712_ -be dim_publisher_apps_daily -iu

uhaul add import --adhoc-import --retention 5 --retention-reason='fixing issue' --partition-name="ds=2016-06-1[6-7]" multi_link_metrics ad_delivery platform

Create a graph of a Job
./status --graphviz tasks/platform/ad_network/audience_network_core_metrics.py | dot -Tjpeg -o ~/test.jpeg

Tableau run
curl -H "Content-Type: application/json" -X POST -d '{"refresh_cfg_id":647}' 'http://bip.thefacebook.com:5001/tableau/run'	

Tableau check
curl -H "Content-Type: application/json" -X POST -d '{"refresh_id": "96459"}' http://bip.thefacebook.com:5001/tableau/check		  
			  
presto platform --execute 'show tables'

presto di --execute 'select country_code, count(1) from dim_mobile_phone group by country_code order by count(1) desc limit 10;'

presto platform --execute 'desc neko_master' --output-format TSV_HEADER		

Run the following command to find out useful information about namespaces
	uhaul query namespace platform
	
Reboot dev server
	ssh shellserver001.ash2.facebook.com
	            or
	ssh shellserver004.prn2.facebook.com
	            then
    devserver-reboot devvm17997.prn1.facebook.com
			  

Code snippets

You can click on the text below, modify it and then copy to use for your command. That won't change the original content.

CASE
	WHEN an4v_impressions > 0 AND ania_impressions > 0 THEN 'active_an4v_and_ia'
	WHEN an4v_impressions > 0 THEN 'active_an4v'
	ELSE 'not_checked_the_box'
END   		  

Parse Json field 
	Hive   - FB_JSON_PATH_EXTRACTOR(extra_fields, '$.view_count_with_sound_on_50' )
	Presto - JSON_EXTRACT(extra_fields, '$.view_count_with_sound_on_50' )			
	          

Mercurial Process

arc pull

arc feature 12933157-IncreaseTableauRefreshRetryTimeouts

Edit code 

NOTE: If new file, add it by running 'hg add'

hg commit -m "Task 12933157 - Changed the retry timeout for Audience Network Dashboard to 9100"

arc diff --preview

NOTE: If you change, don't do commit. do 'hg amend'

arc feature master

hg bookmark -D 12933157-IncreaseTableauRefreshRetryTimeouts

arc pull
	          

Misc

Copy following and paste in a browser window to create a temporary text editor
			  
data:text/html, <title>Text Editor</title><body contenteditable style="font-size:2rem;font-family:georgia;line-height:1.4;max-width:60rem;margin:0 auto;padding:4rem;"></body>