change empties to null
This commit is contained in:
		
							parent
							
								
									48dabfd691
								
							
						
					
					
						commit
						375c6d940e
					
				| 
						 | 
				
			
			@ -14,6 +14,16 @@ select * from "raw".fielding;
 | 
			
		|||
alter table fielding drop column "lgID";
 | 
			
		||||
alter table fielding drop column "teamID";
 | 
			
		||||
 | 
			
		||||
update fielding
 | 
			
		||||
set
 | 
			
		||||
	gs = nullif(gs,''),
 | 
			
		||||
	innouts = nullif(innouts,''),
 | 
			
		||||
	pb = nullif(pb,''),
 | 
			
		||||
	wp = nullif(wp,''),
 | 
			
		||||
	sb = nullif(sb,''),
 | 
			
		||||
	cs = nullif(cs,''),
 | 
			
		||||
	zr = nullif(zr,'');
 | 
			
		||||
 | 
			
		||||
CREATE TABLE IF NOT EXISTS main."fielding" (
 | 
			
		||||
	"player"	TEXT,
 | 
			
		||||
	"year"	NUMERIC,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,6 +9,16 @@ select * from fieldingofsplit;
 | 
			
		|||
alter table fieldingofsplit drop column "lgID";
 | 
			
		||||
alter table fieldingofsplit drop column "teamID";
 | 
			
		||||
 | 
			
		||||
update fieldingofsplit
 | 
			
		||||
set
 | 
			
		||||
	gs = nullif(gs,''),
 | 
			
		||||
	innouts = nullif(innouts,''),
 | 
			
		||||
	pb = nullif(pb,''),
 | 
			
		||||
	wp = nullif(wp,''),
 | 
			
		||||
	sb = nullif(sb,''),
 | 
			
		||||
	cs = nullif(cs,''),
 | 
			
		||||
	zr = nullif(zr,'');
 | 
			
		||||
 | 
			
		||||
CREATE TABLE IF NOT EXISTS main."fieldingofsplit" (
 | 
			
		||||
	"player"	TEXT,
 | 
			
		||||
	"year"	NUMERIC,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,6 +9,14 @@ select * from "raw".fieldingpost;
 | 
			
		|||
alter table fieldingpost drop column "lgID";
 | 
			
		||||
alter table fieldingpost drop column "teamID";
 | 
			
		||||
 | 
			
		||||
update fieldingpost
 | 
			
		||||
set
 | 
			
		||||
	gs = nullif(gs,''),
 | 
			
		||||
	innouts = nullif(innouts,''),
 | 
			
		||||
	pb = nullif(pb,''),
 | 
			
		||||
	sb = nullif(sb,''),
 | 
			
		||||
	cs = nullif(cs,'');
 | 
			
		||||
 | 
			
		||||
CREATE TABLE IF NOT EXISTS main."fieldingpost" (
 | 
			
		||||
	"player"	TEXT,
 | 
			
		||||
	"year"	NUMERIC,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,6 +10,10 @@ update franchises
 | 
			
		|||
set active = 'N'
 | 
			
		||||
where active = 'NA';
 | 
			
		||||
 | 
			
		||||
update franchises
 | 
			
		||||
set
 | 
			
		||||
	NAassoc = nullif(NAassoc,'');
 | 
			
		||||
 | 
			
		||||
CREATE TABLE IF NOT EXISTS main."franchises" (
 | 
			
		||||
	"ID"	TEXT,
 | 
			
		||||
	"name"	TEXT,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,12 +15,10 @@ select distinct yearid, votedby, ballots, needed, "needed_note"
 | 
			
		|||
from "raw".halloffame;
 | 
			
		||||
 | 
			
		||||
update halloffamereqs
 | 
			
		||||
set ballots = null
 | 
			
		||||
where ballots = "";
 | 
			
		||||
 | 
			
		||||
update halloffamereqs
 | 
			
		||||
set needed = null
 | 
			
		||||
where needed = "";
 | 
			
		||||
set
 | 
			
		||||
	ballots = nullif(ballots,''),
 | 
			
		||||
	needed = nullif(needed,''),
 | 
			
		||||
	"needed_note" = nullif("needed_note",'');
 | 
			
		||||
 | 
			
		||||
create table if not exists main."halloffamereqs" (
 | 
			
		||||
	"year"	numeric,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,12 +14,18 @@ insert into people values
 | 
			
		|||
 | 
			
		||||
update people
 | 
			
		||||
set
 | 
			
		||||
	birthcountry = nullif(birthcountry, ''),
 | 
			
		||||
	birthstate = nullif(birthstate, ''),
 | 
			
		||||
	birthcity = nullif(birthcity, ''),
 | 
			
		||||
	birthYear = nullif(birthYear, ''),
 | 
			
		||||
	birthMonth = nullif(birthMonth, ''),
 | 
			
		||||
	birthDay = nullif(birthDay, ''),
 | 
			
		||||
	deathYear = nullif(deathYear, ''),
 | 
			
		||||
	deathMonth = nullif(deathMonth, ''),
 | 
			
		||||
	deathDay = nullif(deathDay, ''),
 | 
			
		||||
	deathcountry = nullif(deathcountry, ''),
 | 
			
		||||
	deathstate = nullif(deathstate, ''),
 | 
			
		||||
	deathcity = nullif(deathcity, ''),
 | 
			
		||||
	weight = nullif(weight, ''),
 | 
			
		||||
	height = nullif(height, ''),
 | 
			
		||||
	bats = nullif(bats, ''),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -35,6 +35,7 @@ set
 | 
			
		|||
	HR = nullif(HR, ''),
 | 
			
		||||
	BB = nullif(BB, ''),
 | 
			
		||||
	SO = nullif(SO, ''),
 | 
			
		||||
	BAOpp = nullif(BAOpp, ''),
 | 
			
		||||
	IBB = nullif(IBB, ''),
 | 
			
		||||
	HBP = nullif(HBP, ''),
 | 
			
		||||
	BFP = nullif(BFP, ''),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -24,8 +24,11 @@ set
 | 
			
		|||
	HR = nullif(HR, ''),
 | 
			
		||||
	BB = nullif(BB, ''),
 | 
			
		||||
	SO = nullif(SO, ''),
 | 
			
		||||
	BAOpp = nullif(BAOpp, ''),
 | 
			
		||||
	IBB = nullif(IBB, ''),
 | 
			
		||||
	WP = nullif(WP, ''),
 | 
			
		||||
	HBP = nullif(HBP, ''),
 | 
			
		||||
	BK = nullif(BK, ''),
 | 
			
		||||
	BFP = nullif(BFP, ''),
 | 
			
		||||
	GF = nullif(GF, ''),
 | 
			
		||||
	R = nullif(R, ''),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -49,6 +49,7 @@ where yearid = 1882 and teamid = 'LS2';
 | 
			
		|||
 | 
			
		||||
update teamseasons
 | 
			
		||||
set
 | 
			
		||||
	divid = nullif(divid, ''),
 | 
			
		||||
	G = nullif(G, ''),
 | 
			
		||||
	Ghome = nullif(Ghome, ''),
 | 
			
		||||
	W = nullif(W, ''),
 | 
			
		||||
| 
						 | 
				
			
			@ -71,7 +72,8 @@ set
 | 
			
		|||
	SO = nullif(SO, ''),
 | 
			
		||||
	HBP = nullif(HBP, ''),
 | 
			
		||||
	R = nullif(R, ''),
 | 
			
		||||
	SF = nullif(SF, '');
 | 
			
		||||
	SF = nullif(SF, ''),
 | 
			
		||||
	attendance = nullif(attendance, '');
 | 
			
		||||
 | 
			
		||||
alter table "teamseasons" drop column "franchID";
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue