Can you open the file in a text editor?
I just did that and found the particular line number where it’s throwing an error (I’m not sure why tho):
Hi Lisa,
Thankyou for your effort, I already posted a screenshot and the line number where the error occurs.
I can try to fix it but I do not know why they wanted to copy a table again and that there are 29 tables, I am not sure why they wrote some code and how they wanted to design the database
I don’t know if this matters, but, there are two columns w/team id:
teamid text,
team_id bigint,
But, if you look at the readme.txt file, that second team_id col doesn’t exist.
I’m a baseball fan and have looked at baseball data and I don’t know what that 2nd team_id is even referring to.
Maybe re-download the tables and see if that fixes the issue.
Hey man, I’m very sorry that I came out as rude. As I said, when referring to the course:
I’d like to check that out as well! I just don’t have access to it…
I don’t have Codecademy PRO, that’s why I couldn’t check your link and had to ask for the rest of your code. Sorry for not being clearer.
Hi all!
I was having the same issue, but I solved the problem with some command line prompts:
- Navigate to the folder with
baseball_database.sql
in the command line. - Run
psql -d <your-baseball-database-name> -f baseball_database.sql
.
And that’s it! Now I can see all of the newly created tables without any problem in my client.
This webpage helped me solve the problem.
P.S., I’m running macOS Catalina 10.15.7 and using PostgreSQL (v. 13.0) and pgAdmin 4 (v. 4.27).
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
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”.
That solved it! Yeah ha KD so much for your help now I’m cooking
This worked for me as well. Thank you for sharing! And thank you to everyone trying to help.
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
Yep, I’m having the same problem. Wish opening the .sql file on Postbird worked…
Update: I got all the data to load. It’s been about a week since I tried, but I uninstalled postgres version 13.1 and downloaded postgres version 12.5 instead which may have been the difference (or maybe someone fixed the .sql file not sure either way it works now).
This worked for me. I tried some of the command line stuff with no luck. Simply downloading postgres 12.5 instead of 13 made it all work. I’m using the same SQL file, so it is the version of postgres that is the issue.
Hey everyone, I was facing a major problem when trying to import Baseball.sql file.
I kept getting this error “authentication method 10 not supported”.
I managed to overcome this error by using the SQL Shell (psql) provided after installing PostgreSQL and Postbird, well one of them .
- You have to login into the postgres user or whatever user you created
- connect to the database you want the data inserted too, I named mine Baseball:
postgres=# \c Baseball
- Using the ‘\i’ command just select the past the file path for the sql file you want to import:
Baseball=# \i '.../TheBestOfBaseballAwards/baseball_database.sql'
.
Every time have error like this:
Select database ‘baseball’
ERROR:
Can not find psql in a system. Make sure PostgreSQL client is installed.
On Ubuntu/Debian - package ‘postgresql-client’
On RHEL/Fedora - package ‘postgresql’
FAILURE
Reinstalled Postbird - didn’t help
Reinstalled PostgreSQL to version 12 - didn’t help
Downloaded ‘postgresql client’ - didn’t help
Maybe it’s time to download SQLite and forget about postgres…
Thanx!! I’ve tried all the other options and didn’t work,. I didn’t want to downgrade postgres as it is suggested above… but your method did the trick! You are awesome!
(I work on windows10, postgres13)