TrainingByPackt / SQL-for-Data-Analytics

Perform fast and efficient data analysis with the power of SQL
MIT License
263 stars 432 forks source link

Importing data.dump #1

Closed GGarrido28 closed 4 years ago

GGarrido28 commented 4 years ago

I'm having issues trying to import data.dump into pgadmin4. I've also tried loading it to MySQL workbench with no success. Any chance that this file comes in .csv or in a different file format?

upomodoro commented 4 years ago

Greetings,

Could you also tell me what operating system you are on, and what the exact error you're getting when you try to upload the data?

GGarrido28 commented 4 years ago

I'm working on macOS Catalina (10.15.3).

Error I get: Gabes-MBP:~ postgres$ psql <data.dump -bash: data.dump: No such file or directory

Tried to calling the directory, then calling psql. Also tried with psql logged in and then calling the directory and got same result. Also tried through pgadmin4 via the "Restore" command which didn't seem to load the tables.

GGarrido28 commented 4 years ago

Any ideas or other solutions to importing the file or getting different file formats?

upomodoro commented 4 years ago

@GGarrido28, that error indicates you're not in the same folder as the file data.dump. Change directory to where that file is and try again.

GGarrido28 commented 4 years ago

As I mentioned before, I had already tried that. The instructions in the book seem to be missing a few steps as I was able to figure out how to load the file after searching for other sources. For future users, these are the steps I took:

  1. Created a new user with admin access in pgAdmin4
  2. Created the sqlda database within pgAdmin4
  3. Ran this terminal command within the folder that had the dataset PATH=/Library/PostgreSQL/12/bin:$PATH
  4. Then I ran this Gabes-MBP:Datasets gabe$ psql -U gabe sqlda < data.dump To which then prompted me for my password. Then it finally created all the necessary tables.

I did get some role errors after executing the import:

ERROR: role "sqldaadmin" does not exist ERROR: role "rdsadmin" does not exist

Not sure the importance of them and whether they are needed to follow along with the book, but it appears that everything that is needed was created.