You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: bootcamp/materials/1-dimensional-data-modeling/README.md
+14-40Lines changed: 14 additions & 40 deletions
Original file line number
Diff line number
Diff line change
@@ -81,39 +81,25 @@ There are two methods to get Postgres running locally.
81
81
- You can check that your Docker Compose stack is running by either:
82
82
- Going into Docker Desktop: you should see an entry there with a drop-down for each of the containers running in your Docker Compose stack.
83
83
- Running **`docker ps -a`** and looking for the containers with the name **`postgres`**.
84
-
- If you navigate to **`http://localhost:5050`** you will be able to see the PGAdmin instance up and running and should be able to connect to the following server:
85
-

86
-
Where:
87
-
- Host name: host.docker.internal (Or container name i.e my-postgres-container)
88
-
- Port: 5432
89
-
- Username: postgres
90
-
- Password: postgres
84
+
- If you navigate to **`http://localhost:5050`** you will be able to see the PGAdmin instance up and running and should be able to connect to the following server as details shown:
- When you're finished with your Postgres instance, you can stop the Docker Compose containers with:
89
+
- When you're finished with your Postgres instance(required in week 1 & 2 & 4), you can stop the Docker Compose containers with:
94
90
95
91
```bash
96
-
make down
92
+
docker compose stop
97
93
```
98
-
99
-
Or if you're on Windows:
100
-
101
-
```bash
102
-
docker compose down -v
103
-
```
104
-
105
-
### :rotating_light: **Need help loading tables?** :rotating_light:
106
94
107
-
> Refer to the instructions below to resolve the issue when the data dump fails to load tables, displaying the message `PostgreSQL Database directory appears to contain a database; Skipping initialization.`
108
-
>
109
-
110
-
## :three: **Connect to Postgres in Database Client**
95
+
## :three: **Connect to Postgres in Local Database Client**
111
96
112
97
- Some options for interacting with your Postgres instance:
113
-
- DataGrip - JetBrains; 30-day free trial or paid version.
98
+
- DataGrip - JetBrains; 30-day free trial or paid version
114
99
- VSCode built-in extension (there are a few of these).
115
100
- PGAdmin.
116
101
- Postbird.
102
+
- Dbeaver
117
103
- Using your client of choice, follow the instructions to establish a new PostgreSQL connection.
118
104
- The default username is **`postgres`** and corresponds to **`$POSTGRES_USER`**in your **`.env`**.
119
105
- The default password is **`postgres`** and corresponds to **`$POSTGRES_PASSWORD`**in your **`.env`**.
@@ -125,28 +111,16 @@ Where:
125
111
126
112
- If the test connection is successful, click "Finish" or "Save" to save the connection. You should now be able to use the database client to manage your PostgreSQL database locally.
127
113
114
+
### :rotating_light: **Need help loading tables?** :rotating_light:
115
+
116
+
> Refer to the instructions below to resolve the issue when the data dump fails to load tables, displaying the message `PostgreSQL Database directory appears to contain a database; Skipping initialization.`
128
117
## **🚨 Tables not loading!? 🚨**
129
-
- If you're seeing errors about `error: invalid command\N`, you should use `pg_restore` to load `data.dump`.
- If you are on Windows and used **`docker compose up`**, table creation and data load will not take place with container creation. Once you have docker container up and verified that you are able to connect to empty postgres database with your own choice of client, follow the following steps:
134
-
1. On Docker desktop, connect to my-postgres-container terminal.
135
-
2. Run:
136
-
```bash
137
-
psql \
138
-
-v ON_ERROR_STOP=1 \
139
-
--username $POSTGRES_USER \
140
-
--dbname $POSTGRES_DB \
141
-
< /docker-entrypoint-initdb.d/data.dump
142
-
```
143
-
- → This will run the file `data.dump` from inside your docker container.
144
118
145
-
- If the tables don't come with the loaded data, follow these steps with manual installation of postgres:
119
+
- If the tables don't come with the loaded data, follow these steps with manual local installation of Postgres:
146
120
147
121
1. Find where your `psql` client is installed (Something like `C:\\Program Files\\PostgreSQL\\13\\runpsql.bat`)
148
122
2. Make sure you're in the root of the repo, and launch `psql` by running that `.bat` script
149
-
3. Enter your credentials forpostgres (describedin the connect to postgres section)
123
+
3. Enter your credentials forPostgres (describedin the connect to Postgres section)
150
124
- → If the above worked, you should now be inside a psql REPL (It looks like `postgres=#`)
151
125
4. Run:
152
126
@@ -156,7 +130,7 @@ Where:
156
130
157
131
- → This will run the file `data.dump` from inside your psql REPL.
158
132
159
-
- If you did the setup using Option 2, and the tables are not in the database, another solution is to:
133
+
- If you did the setup using Option 2 which is Docker option, and the tables are not in the database, another solution is to:
160
134
161
135
1. Find the container id by running `docker ps` - under CONTAINER ID
162
136
2. Go inside the container by executing `docker exec -it <container_name_or_id> bash`
0 commit comments