change empties to null

This commit is contained in:
Nick Griffey 2024-02-04 16:20:07 -06:00
parent 48dabfd691
commit 375c6d940e
9 changed files with 49 additions and 7 deletions

View File

@ -14,6 +14,16 @@ select * from "raw".fielding;
alter table fielding drop column "lgID"; alter table fielding drop column "lgID";
alter table fielding drop column "teamID"; 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" ( CREATE TABLE IF NOT EXISTS main."fielding" (
"player" TEXT, "player" TEXT,
"year" NUMERIC, "year" NUMERIC,

View File

@ -9,6 +9,16 @@ select * from fieldingofsplit;
alter table fieldingofsplit drop column "lgID"; alter table fieldingofsplit drop column "lgID";
alter table fieldingofsplit drop column "teamID"; 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" ( CREATE TABLE IF NOT EXISTS main."fieldingofsplit" (
"player" TEXT, "player" TEXT,
"year" NUMERIC, "year" NUMERIC,

View File

@ -9,6 +9,14 @@ select * from "raw".fieldingpost;
alter table fieldingpost drop column "lgID"; alter table fieldingpost drop column "lgID";
alter table fieldingpost drop column "teamID"; 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" ( CREATE TABLE IF NOT EXISTS main."fieldingpost" (
"player" TEXT, "player" TEXT,
"year" NUMERIC, "year" NUMERIC,

View File

@ -10,6 +10,10 @@ update franchises
set active = 'N' set active = 'N'
where active = 'NA'; where active = 'NA';
update franchises
set
NAassoc = nullif(NAassoc,'');
CREATE TABLE IF NOT EXISTS main."franchises" ( CREATE TABLE IF NOT EXISTS main."franchises" (
"ID" TEXT, "ID" TEXT,
"name" TEXT, "name" TEXT,

View File

@ -15,12 +15,10 @@ select distinct yearid, votedby, ballots, needed, "needed_note"
from "raw".halloffame; from "raw".halloffame;
update halloffamereqs update halloffamereqs
set ballots = null set
where ballots = ""; ballots = nullif(ballots,''),
needed = nullif(needed,''),
update halloffamereqs "needed_note" = nullif("needed_note",'');
set needed = null
where needed = "";
create table if not exists main."halloffamereqs" ( create table if not exists main."halloffamereqs" (
"year" numeric, "year" numeric,

View File

@ -14,12 +14,18 @@ insert into people values
update people update people
set set
birthcountry = nullif(birthcountry, ''),
birthstate = nullif(birthstate, ''),
birthcity = nullif(birthcity, ''),
birthYear = nullif(birthYear, ''), birthYear = nullif(birthYear, ''),
birthMonth = nullif(birthMonth, ''), birthMonth = nullif(birthMonth, ''),
birthDay = nullif(birthDay, ''), birthDay = nullif(birthDay, ''),
deathYear = nullif(deathYear, ''), deathYear = nullif(deathYear, ''),
deathMonth = nullif(deathMonth, ''), deathMonth = nullif(deathMonth, ''),
deathDay = nullif(deathDay, ''), deathDay = nullif(deathDay, ''),
deathcountry = nullif(deathcountry, ''),
deathstate = nullif(deathstate, ''),
deathcity = nullif(deathcity, ''),
weight = nullif(weight, ''), weight = nullif(weight, ''),
height = nullif(height, ''), height = nullif(height, ''),
bats = nullif(bats, ''), bats = nullif(bats, ''),

View File

@ -35,6 +35,7 @@ set
HR = nullif(HR, ''), HR = nullif(HR, ''),
BB = nullif(BB, ''), BB = nullif(BB, ''),
SO = nullif(SO, ''), SO = nullif(SO, ''),
BAOpp = nullif(BAOpp, ''),
IBB = nullif(IBB, ''), IBB = nullif(IBB, ''),
HBP = nullif(HBP, ''), HBP = nullif(HBP, ''),
BFP = nullif(BFP, ''), BFP = nullif(BFP, ''),

View File

@ -24,8 +24,11 @@ set
HR = nullif(HR, ''), HR = nullif(HR, ''),
BB = nullif(BB, ''), BB = nullif(BB, ''),
SO = nullif(SO, ''), SO = nullif(SO, ''),
BAOpp = nullif(BAOpp, ''),
IBB = nullif(IBB, ''), IBB = nullif(IBB, ''),
WP = nullif(WP, ''),
HBP = nullif(HBP, ''), HBP = nullif(HBP, ''),
BK = nullif(BK, ''),
BFP = nullif(BFP, ''), BFP = nullif(BFP, ''),
GF = nullif(GF, ''), GF = nullif(GF, ''),
R = nullif(R, ''), R = nullif(R, ''),

View File

@ -49,6 +49,7 @@ where yearid = 1882 and teamid = 'LS2';
update teamseasons update teamseasons
set set
divid = nullif(divid, ''),
G = nullif(G, ''), G = nullif(G, ''),
Ghome = nullif(Ghome, ''), Ghome = nullif(Ghome, ''),
W = nullif(W, ''), W = nullif(W, ''),
@ -71,7 +72,8 @@ set
SO = nullif(SO, ''), SO = nullif(SO, ''),
HBP = nullif(HBP, ''), HBP = nullif(HBP, ''),
R = nullif(R, ''), R = nullif(R, ''),
SF = nullif(SF, ''); SF = nullif(SF, ''),
attendance = nullif(attendance, '');
alter table "teamseasons" drop column "franchID"; alter table "teamseasons" drop column "franchID";