Skip to content

Instantly share code, notes, and snippets.

Created August 18, 2017 14:11
Show Gist options
  • Save anonymous/74fd2578f3a7c315140c6d0c34f0705d to your computer and use it in GitHub Desktop.
Save anonymous/74fd2578f3a7c315140c6d0c34f0705d to your computer and use it in GitHub Desktop.
// Create AllstarFull
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/chadwickbureau/baseballdatabank/master/core/AllstarFull.csv" AS row
CREATE(:AllstarFull
{
`playerID`: row.`playerID`,
`yearID`: row.`yearID`,
`gameNum`: row.`gameNum`,
`gameID`: row.`gameID`,
`teamID`: row.`teamID`,
`lgID`: row.`lgID`,
`GP`: row.`GP`,
`startingPos`: row.`startingPos`
});
// Create Appearances
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/chadwickbureau/baseballdatabank/master/core/Appearances.csv" AS row
CREATE(:Appearances
{
`yearID`: row.`yearID`,
`teamID`: row.`teamID`,
`lgID`: row.`lgID`,
`playerID`: row.`playerID`,
`G_all`: row.`G_all`,
`GS`: row.`GS`,
`G_batting`: row.`G_batting`,
`G_defense`: row.`G_defense`,
`G_p`: row.`G_p`,
`G_c`: row.`G_c`,
`G_1b`: row.`G_1b`,
`G_2b`: row.`G_2b`,
`G_3b`: row.`G_3b`,
`G_ss`: row.`G_ss`,
`G_lf`: row.`G_lf`,
`G_cf`: row.`G_cf`,
`G_rf`: row.`G_rf`,
`G_of`: row.`G_of`,
`G_dh`: row.`G_dh`,
`G_ph`: row.`G_ph`,
`G_pr`: row.`G_pr`
});
// Create AwardsManagers
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/chadwickbureau/baseballdatabank/master/core/AwardsManagers.csv" AS row
CREATE(:AwardsManagers
{
`playerID`: row.`playerID`,
`awardID`: row.`awardID`,
`yearID`: row.`yearID`,
`lgID`: row.`lgID`,
`tie`: row.`tie`,
`notes`: row.`notes`
});
// Create AwardsPlayers
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/chadwickbureau/baseballdatabank/master/core/AwardsPlayers.csv" AS row
CREATE(:AwardsPlayers
{
`playerID`: row.`playerID`,
`awardID`: row.`awardID`,
`yearID`: row.`yearID`,
`lgID`: row.`lgID`,
`tie`: row.`tie`,
`notes`: row.`notes`
});
// Create AwardsShareManagers
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/chadwickbureau/baseballdatabank/master/core/AwardsShareManagers.csv" AS row
CREATE(:AwardsShareManagers
{
`awardID`: row.`awardID`,
`yearID`: row.`yearID`,
`lgID`: row.`lgID`,
`playerID`: row.`playerID`,
`pointsWon`: row.`pointsWon`,
`pointsMax`: row.`pointsMax`,
`votesFirst`: row.`votesFirst`
});
// Create AwardsSharePlayers
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/chadwickbureau/baseballdatabank/master/core/AwardsSharePlayers.csv" AS row
CREATE(:AwardsSharePlayers
{
`awardID`: row.`awardID`,
`yearID`: row.`yearID`,
`lgID`: row.`lgID`,
`playerID`: row.`playerID`,
`pointsWon`: row.`pointsWon`,
`pointsMax`: row.`pointsMax`,
`votesFirst`: row.`votesFirst`
});
// Create Batting
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/chadwickbureau/baseballdatabank/master/core/Batting.csv" AS row
CREATE(:Batting
{
`playerID`: row.`playerID`,
`yearID`: row.`yearID`,
`stint`: row.`stint`,
`teamID`: row.`teamID`,
`lgID`: row.`lgID`,
`G`: row.`G`,
`AB`: row.`AB`,
`R`: row.`R`,
`H`: row.`H`,
`2B`: row.`2B`,
`3B`: row.`3B`,
`HR`: row.`HR`,
`RBI`: row.`RBI`,
`SB`: row.`SB`,
`CS`: row.`CS`,
`BB`: row.`BB`,
`SO`: row.`SO`,
`IBB`: row.`IBB`,
`HBP`: row.`HBP`,
`SH`: row.`SH`,
`SF`: row.`SF`,
`GIDP`: row.`GIDP`
});
// Create BattingPost
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/chadwickbureau/baseballdatabank/master/core/BattingPost.csv" AS row
CREATE(:BattingPost
{
`yearID`: row.`yearID`,
`round`: row.`round`,
`playerID`: row.`playerID`,
`teamID`: row.`teamID`,
`lgID`: row.`lgID`,
`G`: row.`G`,
`AB`: row.`AB`,
`R`: row.`R`,
`H`: row.`H`,
`2B`: row.`2B`,
`3B`: row.`3B`,
`HR`: row.`HR`,
`RBI`: row.`RBI`,
`SB`: row.`SB`,
`CS`: row.`CS`,
`BB`: row.`BB`,
`SO`: row.`SO`,
`IBB`: row.`IBB`,
`HBP`: row.`HBP`,
`SH`: row.`SH`,
`SF`: row.`SF`,
`GIDP`: row.`GIDP`
});
// Create CollegePlaying
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/chadwickbureau/baseballdatabank/master/core/CollegePlaying.csv" AS row
CREATE(:CollegePlaying
{
`playerID`: row.`playerID`,
`schoolID`: row.`schoolID`,
`yearID`: row.`yearID`
});
// Create Fielding
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/chadwickbureau/baseballdatabank/master/core/Fielding.csv" AS row
CREATE(:Fielding
{
`playerID`: row.`playerID`,
`yearID`: row.`yearID`,
`stint`: row.`stint`,
`teamID`: row.`teamID`,
`lgID`: row.`lgID`,
`POS`: row.`POS`,
`G`: row.`G`,
`GS`: row.`GS`,
`InnOuts`: row.`InnOuts`,
`PO`: row.`PO`,
`A`: row.`A`,
`E`: row.`E`,
`DP`: row.`DP`,
`PB`: row.`PB`,
`WP`: row.`WP`,
`SB`: row.`SB`,
`CS`: row.`CS`,
`ZR`: row.`ZR`
});
// Create FieldingOF
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/chadwickbureau/baseballdatabank/master/core/FieldingOF.csv" AS row
CREATE(:FieldingOF
{
`playerID`: row.`playerID`,
`yearID`: row.`yearID`,
`stint`: row.`stint`,
`Glf`: row.`Glf`,
`Gcf`: row.`Gcf`,
`Grf`: row.`Grf`
});
// Create FieldingOFsplit
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/chadwickbureau/baseballdatabank/master/core/FieldingOFsplit.csv" AS row
CREATE(:FieldingOFsplit
{
`playerID`: row.`playerID`,
`yearID`: row.`yearID`,
`stint`: row.`stint`,
`teamID`: row.`teamID`,
`lgID`: row.`lgID`,
`POS`: row.`POS`,
`G`: row.`G`,
`GS`: row.`GS`,
`InnOuts`: row.`InnOuts`,
`PO`: row.`PO`,
`A`: row.`A`,
`E`: row.`E`,
`DP`: row.`DP`,
`PB`: row.`PB`,
`WP`: row.`WP`,
`SB`: row.`SB`,
`CS`: row.`CS`,
`ZR`: row.`ZR`
});
// Create FieldingPost
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/chadwickbureau/baseballdatabank/master/core/FieldingPost.csv" AS row
CREATE(:FieldingPost
{
`playerID`: row.`playerID`,
`yearID`: row.`yearID`,
`teamID`: row.`teamID`,
`lgID`: row.`lgID`,
`round`: row.`round`,
`POS`: row.`POS`,
`G`: row.`G`,
`GS`: row.`GS`,
`InnOuts`: row.`InnOuts`,
`PO`: row.`PO`,
`A`: row.`A`,
`E`: row.`E`,
`DP`: row.`DP`,
`TP`: row.`TP`,
`PB`: row.`PB`,
`SB`: row.`SB`,
`CS`: row.`CS`
});
// Create HallOfFame
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/chadwickbureau/baseballdatabank/master/core/HallOfFame.csv" AS row
CREATE(:HallOfFame
{
`playerID`: row.`playerID`,
`yearid`: row.`yearid`,
`votedBy`: row.`votedBy`,
`ballots`: row.`ballots`,
`needed`: row.`needed`,
`votes`: row.`votes`,
`inducted`: row.`inducted`,
`category`: row.`category`,
`needed_note`: row.`needed_note`
});
// Create HomeGames
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/chadwickbureau/baseballdatabank/master/core/HomeGames.csv" AS row
CREATE(:HomeGames
{
`year.key`: row.`year.key`,
`league.key`: row.`league.key`,
`team.key`: row.`team.key`,
`park.key`: row.`park.key`,
`span.first`: row.`span.first`,
`span.last`: row.`span.last`,
`games`: row.`games`,
`openings`: row.`openings`,
`attendance`: row.`attendance`
});
// Create Managers
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/chadwickbureau/baseballdatabank/master/core/Managers.csv" AS row
CREATE(:Managers
{
`playerID`: row.`playerID`,
`yearID`: row.`yearID`,
`teamID`: row.`teamID`,
`lgID`: row.`lgID`,
`inseason`: row.`inseason`,
`G`: row.`G`,
`W`: row.`W`,
`L`: row.`L`,
`rank`: row.`rank`,
`plyrMgr`: row.`plyrMgr`
});
// Create ManagersHalf
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/chadwickbureau/baseballdatabank/master/core/ManagersHalf.csv" AS row
CREATE(:ManagersHalf
{
`playerID`: row.`playerID`,
`yearID`: row.`yearID`,
`teamID`: row.`teamID`,
`lgID`: row.`lgID`,
`inseason`: row.`inseason`,
`half`: row.`half`,
`G`: row.`G`,
`W`: row.`W`,
`L`: row.`L`,
`rank`: row.`rank`
});
// Create People
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/chadwickbureau/baseballdatabank/master/core/People.csv" AS row
CREATE(:People
{
`playerID`: row.`playerID`,
`birthYear`: row.`birthYear`,
`birthMonth`: row.`birthMonth`,
`birthDay`: row.`birthDay`,
`birthCountry`: row.`birthCountry`,
`birthState`: row.`birthState`,
`birthCity`: row.`birthCity`,
`deathYear`: row.`deathYear`,
`deathMonth`: row.`deathMonth`,
`deathDay`: row.`deathDay`,
`deathCountry`: row.`deathCountry`,
`deathState`: row.`deathState`,
`deathCity`: row.`deathCity`,
`nameFirst`: row.`nameFirst`,
`nameLast`: row.`nameLast`,
`nameGiven`: row.`nameGiven`,
`weight`: row.`weight`,
`height`: row.`height`,
`bats`: row.`bats`,
`throws`: row.`throws`,
`debut`: row.`debut`,
`finalGame`: row.`finalGame`,
`retroID`: row.`retroID`,
`bbrefID`: row.`bbrefID`
});
// Create Parks
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/chadwickbureau/baseballdatabank/master/core/Parks.csv" AS row
CREATE(:Parks
{
`park.key`: row.`park.key`,
`park.name`: row.`park.name`,
`park.alias`: row.`park.alias`,
`city`: row.`city`,
`state`: row.`state`,
`country`: row.`country`
});
// Create Pitching
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/chadwickbureau/baseballdatabank/master/core/Pitching.csv" AS row
CREATE(:Pitching
{
`playerID`: row.`playerID`,
`yearID`: row.`yearID`,
`stint`: row.`stint`,
`teamID`: row.`teamID`,
`lgID`: row.`lgID`,
`W`: row.`W`,
`L`: row.`L`,
`G`: row.`G`,
`GS`: row.`GS`,
`CG`: row.`CG`,
`SHO`: row.`SHO`,
`SV`: row.`SV`,
`IPouts`: row.`IPouts`,
`H`: row.`H`,
`ER`: row.`ER`,
`HR`: row.`HR`,
`BB`: row.`BB`,
`SO`: row.`SO`,
`BAOpp`: row.`BAOpp`,
`ERA`: row.`ERA`,
`IBB`: row.`IBB`,
`WP`: row.`WP`,
`HBP`: row.`HBP`,
`BK`: row.`BK`,
`BFP`: row.`BFP`,
`GF`: row.`GF`,
`R`: row.`R`,
`SH`: row.`SH`,
`SF`: row.`SF`,
`GIDP`: row.`GIDP`
});
// Create PitchingPost
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/chadwickbureau/baseballdatabank/master/core/PitchingPost.csv" AS row
CREATE(:PitchingPost
{
`playerID`: row.`playerID`,
`yearID`: row.`yearID`,
`round`: row.`round`,
`teamID`: row.`teamID`,
`lgID`: row.`lgID`,
`W`: row.`W`,
`L`: row.`L`,
`G`: row.`G`,
`GS`: row.`GS`,
`CG`: row.`CG`,
`SHO`: row.`SHO`,
`SV`: row.`SV`,
`IPouts`: row.`IPouts`,
`H`: row.`H`,
`ER`: row.`ER`,
`HR`: row.`HR`,
`BB`: row.`BB`,
`SO`: row.`SO`,
`BAOpp`: row.`BAOpp`,
`ERA`: row.`ERA`,
`IBB`: row.`IBB`,
`WP`: row.`WP`,
`HBP`: row.`HBP`,
`BK`: row.`BK`,
`BFP`: row.`BFP`,
`GF`: row.`GF`,
`R`: row.`R`,
`SH`: row.`SH`,
`SF`: row.`SF`,
`GIDP`: row.`GIDP`
});
// Create Salaries
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/chadwickbureau/baseballdatabank/master/core/Salaries.csv" AS row
CREATE(:Salaries
{
`yearID`: row.`yearID`,
`teamID`: row.`teamID`,
`lgID`: row.`lgID`,
`playerID`: row.`playerID`,
`salary`: row.`salary`
});
// Create Schools
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/chadwickbureau/baseballdatabank/master/core/Schools.csv" AS row
CREATE(:Schools
{
`schoolID`: row.`schoolID`,
`name_full`: row.`name_full`,
`city`: row.`city`,
`state`: row.`state`,
`country`: row.`country`
});
// Create SeriesPost
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/chadwickbureau/baseballdatabank/master/core/SeriesPost.csv" AS row
CREATE(:SeriesPost
{
`yearID`: row.`yearID`,
`round`: row.`round`,
`teamIDwinner`: row.`teamIDwinner`,
`lgIDwinner`: row.`lgIDwinner`,
`teamIDloser`: row.`teamIDloser`,
`lgIDloser`: row.`lgIDloser`,
`wins`: row.`wins`,
`losses`: row.`losses`,
`ties`: row.`ties`
});
// Create Teams
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/chadwickbureau/baseballdatabank/master/core/Teams.csv" AS row
CREATE(:Teams
{
`yearID`: row.`yearID`,
`lgID`: row.`lgID`,
`teamID`: row.`teamID`,
`franchID`: row.`franchID`,
`divID`: row.`divID`,
`Rank`: row.`Rank`,
`G`: row.`G`,
`Ghome`: row.`Ghome`,
`W`: row.`W`,
`L`: row.`L`,
`DivWin`: row.`DivWin`,
`WCWin`: row.`WCWin`,
`LgWin`: row.`LgWin`,
`WSWin`: row.`WSWin`,
`R`: row.`R`,
`AB`: row.`AB`,
`H`: row.`H`,
`2B`: row.`2B`,
`3B`: row.`3B`,
`HR`: row.`HR`,
`BB`: row.`BB`,
`SO`: row.`SO`,
`SB`: row.`SB`,
`CS`: row.`CS`,
`HBP`: row.`HBP`,
`SF`: row.`SF`,
`RA`: row.`RA`,
`ER`: row.`ER`,
`ERA`: row.`ERA`,
`CG`: row.`CG`,
`SHO`: row.`SHO`,
`SV`: row.`SV`,
`IPouts`: row.`IPouts`,
`HA`: row.`HA`,
`HRA`: row.`HRA`,
`BBA`: row.`BBA`,
`SOA`: row.`SOA`,
`E`: row.`E`,
`DP`: row.`DP`,
`FP`: row.`FP`,
`name`: row.`name`,
`park`: row.`park`,
`attendance`: row.`attendance`,
`BPF`: row.`BPF`,
`PPF`: row.`PPF`,
`teamIDBR`: row.`teamIDBR`,
`teamIDlahman45`: row.`teamIDlahman45`,
`teamIDretro`: row.`teamIDretro`
});
// Create TeamsFranchises
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/chadwickbureau/baseballdatabank/master/core/TeamsFranchises.csv" AS row
CREATE(:TeamsFranchises
{
`franchID`: row.`franchID`,
`franchName`: row.`franchName`,
`active`: row.`active`,
`NAassoc`: row.`NAassoc`
});
// Create TeamsHalf
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/chadwickbureau/baseballdatabank/master/core/TeamsHalf.csv" AS row
CREATE(:TeamsHalf
{
`yearID`: row.`yearID`,
`lgID`: row.`lgID`,
`teamID`: row.`teamID`,
`Half`: row.`Half`,
`divID`: row.`divID`,
`DivWin`: row.`DivWin`,
`Rank`: row.`Rank`,
`G`: row.`G`,
`W`: row.`W`,
`L`: row.`L`
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment