GithubHelp home page GithubHelp logo

yothenberg / lahman-postgres Goto Github PK

View Code? Open in Web Editor NEW

This project forked from brentnycum/lahman-postgres

1.0 3.0 0.0 9.41 MB

Conversion of the Lahman Baseball Database to PostgreSQL.

PLpgSQL 100.00%

lahman-postgres's Introduction

The Lahman Baseball Database (PostgreSQL)

Conversion of the Lahman Baseball Database structure to PostgreSQL.

Changes

Postgres doesn't like columns that begin with numbers without switching to quoted column names. So all 2B and 3B columns have been converted to H2B and H3B.

Importing

Download the latest CSV and import.

COPY AllstarFull FROM '/path/to/AllstarFull.csv' DELIMITER ',' CSV;
COPY Appearances FROM '/path/to/Appearances.csv' DELIMITER ',' CSV;
COPY AwardsManagers FROM '/path/to/AwardsManagers.csv' DELIMITER ',' CSV;
COPY AwardsPlayers FROM '/path/to/AwardsPlayers.csv' DELIMITER ',' CSV;
COPY AwardsShareManagers FROM '/path/to/AwardsShareManagers.csv' DELIMITER ',' CSV;
COPY AwardsSharePlayers FROM '/path/to/AwardsSharePlayers.csv' DELIMITER ',' CSV;
COPY Batting FROM '/path/to/Batting.csv' DELIMITER ',' CSV;
COPY BattingPost FROM '/path/to/BattingPost.csv' DELIMITER ',' CSV;
COPY Fielding FROM '/path/to/Fielding.csv' DELIMITER ',' CSV;
COPY FieldingOF FROM '/path/to/FieldingOF.csv' DELIMITER ',' CSV;
COPY FieldingPost FROM '/path/to/FieldingPost.csv' DELIMITER ',' CSV;
COPY HallOfFame FROM '/path/to/HallOfFame.csv' DELIMITER ',' CSV;
COPY Managers FROM '/path/to/Managers.csv' DELIMITER ',' CSV;
COPY ManagersHalf FROM '/path/to/ManagersHalf.csv' DELIMITER ',' CSV;
COPY Master (playerID,birthYear,birthMonth,birthDay,birthCountry,birthState,birthCity,deathYear,deathMonth,deathDay,deathCountry,deathState,deathCity,nameFirst,nameLast,nameGiven,weight,height,bats,throws,debut,finalGame,retroID,bbrefID) FROM '/path/to/Master.csv' DELIMITER ',' CSV;
COPY Pitching FROM '/path/to/Pitching.csv' DELIMITER ',' CSV;
COPY PitchingPost FROM '/path/to/PitchingPost.csv' DELIMITER ',' CSV;
COPY Salaries FROM '/path/to/Salaries.csv' DELIMITER ',' CSV;
COPY Schools FROM '/path/to/Schools.csv' DELIMITER ',' CSV;
COPY SchoolsPlayers FROM '/path/to/SchoolsPlayers.csv' DELIMITER ',' CSV;
COPY SeriesPost FROM '/path/to/SeriesPost.csv' DELIMITER ',' CSV;
COPY Teams FROM '/path/to/Teams.csv' DELIMITER ',' CSV;
COPY TeamsFranchises FROM '/path/to/TeamsFranchises.csv' DELIMITER ',' CSV;
COPY TeamsHalf FROM '/path/to/TeamsHalf.csv' DELIMITER ',' CSV;

Things To Do

  • Optimize, database needs more indexes.
  • Create advanced statistics table instead of calculating for each query (things like ISO, FIP, etc).

Copyright Notice & Limited Use License

This database is copyright 1996-2013 by Sean Lahman.

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. For details see: http://creativecommons.org/licenses/by-sa/3.0/

For licensing information or further information, contact Sean Lahman at: [email protected]

lahman-postgres's People

Contributors

brentnycum avatar

Stargazers

 avatar

Watchers

Mark Wright avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.