data-engineer-handbook icon indicating copy to clipboard operation
data-engineer-handbook copied to clipboard

README for materials/1-dimensional-data-modeling missed user creation step

Open gitgithan opened this issue 1 year ago • 5 comments

Run this command after replacing <computer-username> with your computer's username:

psql -U <computer-username> postgres < data.dump

This command failed until I did CREATE ROLE <computer-username> WITH LOGIN SUPERUSER PASSWORD <pass>;

In Dbeaver postgres which uses JDBC, it seems JDBC requires a password too, so using the default postgres which has no password would not connect.

So even if students did not create a new ROLE for <computer-username> and used the default postgres user, they would still fail to connect to dbeaver until a password is added with something like ALTER ROLE postgres WITH PASSWORD 'postgres';

The docker method did not have these complexities because the postgres image required the password and created the required roles as the image started. `

gitgithan avatar Nov 18 '24 17:11 gitgithan

JDBC، يبدو أن JDBC يتطلب كلمة مرور أيضًا، لذا فإن استخدام postgres الافتراضي الذي لا يحتوي على كلمة مرور لن يؤدي إلى الاتصال.

لذلك حتى لو لم ينشئ الطلاب دورًا جديدًا واستخدموا مستخدم postgres الافتراضي، فسيظلون يفشلون في الاتصال بـ dbeaver حتى تتم إضافة كلمة مرور بشيء مثلALTER ROLE postgres WITH PASSWORD 'postgres';

لم تكن طريقة Docker تحتوي على هذه التعقيدات لأن صورة Postgres تتطلب كلمة المرور وتنشئ الأدوار المطلوبة عند بدء تشغيل الصورة

GuendouzeAhcene avatar Nov 19 '24 18:11 GuendouzeAhcene

@gitgithan, In order to set up the postgres on your local instance, you have to perform the following steps:

  1. clone the repo using the command git clone <URL>
  2. Open the repo in an IDE. VS code for instance
  3. Create a copy of example.env file to .env file
  4. Make adjustments to the values in the file if required. You have to specify the username and password here. Save the .env file.
  5. From terminal perform docker compose up. Make sure docker desktop on the machine in running.
  6. This will setup the DB in your local machine.

vanandjiwala avatar Nov 23 '24 04:11 vanandjiwala

@vanandjiwala Using docker was not the issue.

I mentioned that

The docker method did not have these complexities

The issue is for people who are not using docker (for whatever reasons) to create the database.

gitgithan avatar Nov 23 '24 08:11 gitgithan

@gitgithan - can you make a PR

ry-v1 avatar Dec 14 '24 18:12 ry-v1

In my case, after having installed with homebrew. I ran into similar issue and had to manually create the postgres role using -

CREATE ROLE postgres WITH LOGIN SUPERUSER PASSWORD 'postgres';

aayu24 avatar Feb 02 '25 10:02 aayu24