-
Notifications
You must be signed in to change notification settings - Fork 264
Detailed Windows PostgreSQL installation
AdrianRutter edited this page Oct 4, 2018
·
13 revisions
-
Download PostgreSQL-9.3.0-1-windows.exe
-
Try to run downloaded file but halted by too smart for its own good OS
- Click
More info
andRun anyway
- Setup wizard begins, click
Next
- Specify installation directory, click
Next
- Specify data directory, click
Next
- Assign password for superuser named
postgres
, clickNext
- Leave port number with default
5432
, clickNext
- Leave
Advanced Options
locale with[Default locale]
, clickNext
- Wizard complete, ready to install, click
Next
- Wait while installation completes
- Finished installing, click
Finish
- A new wizard opens up - Stack Builder 3.1.1; This wizard we are going to ignore. Click
Cancel
->Yes
- Open Command Prompt and navigate to the install location selected in step 5. above
-
createuser.exe -U postgres -E -P nfldb
Using superuserpostgres
, create a new user namednfldb
. Assign a password for usernfldb
, enter it again to confirm, and finally enter the password for accountpostgres
that you assigned in step 7. above
-
createdb.exe -U postgres -O nfldb nfldb
Using superuserpostgres
, create a new database namednfldb
. Make the owner of this database usernfldb
-
psql.exe -U postgres -c "CREATE EXTENSION fuzzystrmatch;" nfldb
Enable fuzzy string matching
-
psql.exe -U nfldb nfldb
Using usernfldb
, log into databasenfldb
-
Download nfldb.sql.zip
-
Extract downloaded zip file
-
psql.exe -U nfldb nfldb < x:\path\to\extracted\nfldb.sql\nfldb.sql
Using usernfldb
, import the downloaded sql database into databasenfldb
- Wait for database to import - took me about 6 minutes on older PC
- Create a copy of the sample config file found in
x:\Python27\share\nfldb
- Create and save a file called
top-ten-qbs.py
import nfldb
db = nfldb.connect()
q = nfldb.Query(db)
q.game(season_year=2012, season_type='Regular')
for pp in q.sort('passing_yds').limit(10).as_aggregate():
print pp.player, pp.passing_yds
- From a command prompt, run
python top-ten-qbs.py
- Finally, run the
nfldb-update
script found in thePython\Scripts
folder
- Congratulations - no one in the world has a more up-to-date
nfldb
database than you.