Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading the Sample Databases #4

Open
jvl98l opened this issue Jul 30, 2020 · 3 comments
Open

Loading the Sample Databases #4

jvl98l opened this issue Jul 30, 2020 · 3 comments

Comments

@jvl98l
Copy link

jvl98l commented Jul 30, 2020

In the book, it states "To install the database on PostgreSQL, copy the data.dump file from the Datasets folder in the GitHub repository of the book.......Then, load the data.dump file from a command line using the command:
psql < data.dump"

Can someone please provide clarification on how this is done?? I've had the same issue as someone else when clicking on file that it brings up the code in a separate window. The book did not do a good job at explaining much of anything in terms of downloading software or loading the data.

@bmag618
Copy link

bmag618 commented Aug 10, 2020

Had the same issue on Mac
The issue I encountered was due to a later version of OpenSSL I had: v1.1.1.dylib
I needed to point to an earlier version: v1.0.0.dylib
When I executed the psql command psql I got the following error:

"dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
Referenced from: /usr/local/lib/libpq.5.dylib
Reason: image not found
Abort trap: 6"

The resolution I used:

  1. brew uninstall --ignore-dependencies openssl brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb

  2. brew switch openssl ls /usr/local/cellar/openssl | sed 's/\///g'

  3. psql -U user -d database < /Users/user/directory/data.dump

Hope this helps

@Jpfeiff42
Copy link

Obviously, it's probably a little late to help out OP, but hopefully this helps other students who are stumped by this as well.

Here is the way I figured it out:

  1. Open the SQL Shell (psql), that came with the PostgreSQL installation package.
  2. Connect to the server/database/user that you would like to use. If you are just using the default settings, you can just press enter until it prompts you for the password.
  3. Type in the password you set for that user and press Enter
  4. On the command line, change your directory to the location of the data.dump file. Using this command:
    dbname=#\cd C:/Users/..../SQL-for-Data-Analytics-master/Datasets (Make sure you pay attention to the direction of the slash marks. If you copy and paste the location from the File Properties in Windows, the slashes will be wrong)
  5. Now that you are in the correct directory, you can use a psql command to load the dump file:
    dbname=# \i data.dump
  6. After psql has finished loading the file, I had to exit and restart the psql terminal before my database would recognize the new tables. I don't know if that is 100% necessary, or if a COMMIT statement would do the same thing.

Best of luck!

@jco1131
Copy link

jco1131 commented Apr 30, 2024

Mine asks for a username, not a password, and then ignores all commands and exits after I press any key.
Maybe my brain is too fried but I cannot figure out what to do to upload the databases.
I've done the command line, I've tried simply creating the database within but run into the data error when it comes inserting the data into the tables for smalljoins, I've tried simply doing it step by step. I'm totally lost and my instructor is busy so slow to reply unfortunately. I've been stuck with this for the last week or so racking my brain and just feeling defeated and frustrated at this point. I'm sure I know what to do but cannot figure it out lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants