Querying Baseball data off platform project

Hi Dav! This is helping me make great progress when I had been running into this issue for awhile now. However, when I run this, I got prompted for the password for my user but was unable to type anything. Do you know how I could add it to the original prompt so it is included?

also, if anyone who needs it, this stack overflow answer solved a problem with the psql command being recognized: https://stackoverflow.com/questions/30401460/postgres-psql-not-recognized-as-an-internal-or-external-command

2 Likes

Try adding a -U flag followed by the user that you want to open the database with? (Not sure if that’ll work!)

That is,

psql -U <username> -d <your-baseball-database-name> -f baseball_database.sql

If you’re not sure what to put for a username, or your username isn’t working, try “postgres”.

1 Like

That solved it! Yeah ha KD so much for your help now I’m cooking

2 Likes

hey @davbyron thanks… that solved the issue

1 Like

This worked for me as well. Thank you for sharing! And thank you to everyone trying to help.

1 Like

how is this solved on Windows 10?

Here’s how to do that in Windows 10:
1- right click on the windows (Aka “Start button”)
2- select “System” (you can reach there from: Settings - About)
3- in the right menu, click on “Advanced system settings”
4- in the window that popped, click on the bottom button that reads “Environment Variables…”
5- in the upper block, click on the variable that reads “Path” (double-click)
6- in the “Edit environment variable” click new
7- in the new line you should enter your path to \bin folder of your postgreSQL (default for version 13: “C:\Program Files\PostgreSQL\13\bin” yours might be different look it up)
8- back track with “Ok” to close all the 3 open windows.
9- now you can open cmd and enter the command @davbyron provided: psql -U <username> -d <your-baseball-database-name> -f baseball_database.sql

voila !

I hope that helps

Thank you for your help! I did all that and this pops up:

psql: error: baseball_database.sql: No such file or directory

or when I write the directory:

psql: error: C:/Users/Katerina/Downloads/TheBestOfBaseballAwards/TheBestOfBaseballAwards: Permission denied

1 Like

Yep, I’m having the same problem. Wish opening the .sql file on Postbird worked…