-
Notifications
You must be signed in to change notification settings - Fork 264
Detailed Windows PostgreSQL installation
Edorn71 edited this page Oct 6, 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
\q
to exit
-
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
Please note that you are importing the nfldb.sql
file that you unzipped and not the nfldb.sql
folder that the file resides in.
If you are seeing Access is denied.
it is likely that you are trying to incorrectly import the folder_
- 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
Rename this copy config.ini
Edit two values in this config file: the timezone & the password for user nfldb
; save and close the file
- 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.