# De-c4w1a1 assignment

**URL:** <https://community.deeplearning.ai/t/de-c4w1a1-assignment/739721>\
**Category:** Data Modeling, Transformation, and Serving\
**Tags:** week-module-1, coursera-platform\
**Created:** [December 23, 2024, 10:46pm UTC](https://community.deeplearning.ai/t/de-c4w1a1-assignment/739721 "2024-12-23T22:46:05Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rajeev\_Prabhakar](https://avatars.discourse-cdn.com/v4/letter/r/f07891/32.png) [@Rajeev\_Prabhakar](https://community.deeplearning.ai/u/Rajeev_Prabhakar)\
**Post date:** [December 23, 2024, 10:46pm UTC](https://community.deeplearning.ai/t/de-c4w1a1-assignment/739721/1 "2024-12-23T22:46:06Z")

</div>

Could someone please help me out…  
On trying cell 1.2 - Source Configuration and even with  
a successful dbt debug command output, when I try the  
cell “1.2.5. Load the connection configuration into the  
notebook with the following cell”, it gives me the following  
error  
psycopg2.OperationalError: could not translate host name “\<DATABASE\_ENDPOINT\>” to address: Name or service not  
known.

profiles.yml (under .dbt directory and under scripts directory)  
has the correct postgres endpoint entry…

---

<div class="post-metadata">

**Author:** ![Amir\_Zare](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/amir_zare/32/95275_2.png) [@Amir\_Zare](https://community.deeplearning.ai/u/Amir_Zare)\
**Post date:** [December 24, 2024, 7:35am UTC](https://community.deeplearning.ai/t/de-c4w1a1-assignment/739721/2 "2024-12-24T07:35:15Z")

</div>

Hello @Rajeev_Prabhakar  
Looks like you have missed this step:  
 ![image](https://global.discourse-cdn.com/dlai/original/3X/7/9/7968a9703a0767c7e4e4e691bdf608062d5e74b3.png)  
The `<DATABASE_ENDPOINT>` should be replaced with the value from CloudFormation. Don’t forget to save the changes made to the file. Moreover, you need to make sure that the exact file is copied to `~/.dbt/profiles.yml` in step 1.2.3.

---

<div class="post-metadata">

**Author:** ![Rajeev\_Prabhakar](https://avatars.discourse-cdn.com/v4/letter/r/f07891/32.png) [@Rajeev\_Prabhakar](https://community.deeplearning.ai/u/Rajeev_Prabhakar)\
**Post date:** [December 24, 2024, 10:47am UTC](https://community.deeplearning.ai/t/de-c4w1a1-assignment/739721/3 "2024-12-24T10:47:59Z")

</div>

Hello Amir,

Although, at an initial glance, it does “appear” that I missed the step, but, I had checked (the profiles.yml) before posting this question, that’s why encountering this error was odd.

I’ll start the lab all over and may be it will work this time…

---

<div class="post-metadata">

**Author:** ![Rajeev\_Prabhakar](https://avatars.discourse-cdn.com/v4/letter/r/f07891/32.png) [@Rajeev\_Prabhakar](https://community.deeplearning.ai/u/Rajeev_Prabhakar)\
**Post date:** [December 24, 2024, 11:56am UTC](https://community.deeplearning.ai/t/de-c4w1a1-assignment/739721/4 "2024-12-24T11:56:11Z")

</div>

I retried and am running into the error again. Also, I did  
confirm again copying profiles.yml to ~/.dbt/profiles.yml.  
I suppose, I must be missing another step or doing  
something incorrectly…

(lab-venv) voclabs:~/.dbt cat profiles.yml classicmodels\_modeling: target: dev outputs: dev: type: postgres threads: 1 host: de-c4w1a1-rds.xxxxxxxxxxxxxxxxx.rds.amazonaws.com port: 5432 # optional dbname: postgres schema: classicmodels user: postgresuser password: xxxxxxx (lab-venv) voclabs:~/.dbt

---

<div class="post-metadata">

**Author:** ![Amir\_Zare](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/amir_zare/32/95275_2.png) [@Amir\_Zare](https://community.deeplearning.ai/u/Amir_Zare)\
**Post date:** [December 24, 2024, 12:38pm UTC](https://community.deeplearning.ai/t/de-c4w1a1-assignment/739721/5 "2024-12-24T12:38:37Z")

</div>

Hello again @Rajeev_Prabhakar  
I tried the lab right now and it seems to be working fine. Please, answer the following so that we dig deeper into the issue:

1. What do you get in step 1.2.4 after running `dbt debug` in the cloud9 terminal? The result should be like this:  
 ![image](https://global.discourse-cdn.com/dlai/original/3X/5/7/57eca8d55beb1f48e8b818810ca18bede5222853.png)
2. Please, add a cell before the one in step 1.2.5 and run the following code and see the results.

```auto
import yaml

with open("./scripts/profiles.yml", 'r') as stream:
    data_loaded = yaml.safe_load(stream)

DBCONFIG["host"]

```

 ![image](https://global.discourse-cdn.com/dlai/original/3X/e/8/e8d7d2b77a5e4b0a0e64fc007387205acb4b3fc3.png)  
This simply reads the `./scripts/profiles.yml` file and outputs the the value in front of `host` variable. If you see `<DATABASE_ENDPOINT>`, it means that the changes has not been made to the file.

---

<div class="post-metadata">

**Author:** ![Rajeev\_Prabhakar](https://avatars.discourse-cdn.com/v4/letter/r/f07891/32.png) [@Rajeev\_Prabhakar](https://community.deeplearning.ai/u/Rajeev_Prabhakar)\
**Post date:** [December 24, 2024, 1:08pm UTC](https://community.deeplearning.ai/t/de-c4w1a1-assignment/739721/6 "2024-12-24T13:08:47Z")

</div>

For step 1, the output I got earlier was  
(lab-venv) voclabs:~/environment/classicmodels\_modeling $ dbt debug  
/home/ec2-user/environment/lab-venv/lib64/python3.9/site-packages/networkx/utils/backends.py:135: RuntimeWarning: networkx backend defined more than once: nx-loopback  
backends.update(\_get\_backends(“networkx.backends”))  
11:37:08 Running with dbt=1.8.1  
11:37:08 dbt version: 1.8.1  
11:37:08 python version: 3.9.20  
11:37:08 python path: /home/ec2-user/environment/lab-venv/bin/python3  
11:37:08 os info: Linux-6.1.119-129.201.amzn2023.x86\_64-x86\_64-with-glibc2.34  
11:37:08 Using profiles dir at /home/ec2-user/.dbt  
11:37:08 Using profiles.yml file at /home/ec2-user/.dbt/profiles.yml  
11:37:08 Using dbt\_project.yml file at /home/ec2-user/environment/classicmodels\_modeling/dbt\_project.yml  
11:37:08 adapter type: postgres  
11:37:08 adapter version: 1.8.1  
11:37:08 Configuration:  
11:37:08 profiles.yml file [OK found and valid]  
11:37:08 dbt\_project.yml file [OK found and valid]  
11:37:08 Required dependencies:  
11:37:08 - git [OK found]

11:37:08 Connection:  
11:37:08 host: [de-c4w1a1-rds.cdyoiwwa0br5.us-east-1.rds.amazonaws.com](http://de-c4w1a1-rds.cdyoiwwa0br5.us-east-1.rds.amazonaws.com)  
11:37:08 port: 5432  
11:37:08 user: postgresuser  
11:37:08 database: postgres  
11:37:08 schema: classicmodels  
11:37:08 connect\_timeout: 10  
11:37:08 role: None  
11:37:08 search\_path: None  
11:37:08 keepalives\_idle: 0  
11:37:08 sslmode: None  
11:37:08 sslcert: None  
11:37:08 sslkey: None  
11:37:08 sslrootcert: None  
11:37:08 application\_name: dbt  
11:37:08 retries: 1  
11:37:08 Registered adapter: postgres=1.8.1  
11:37:09 Connection test: [OK connection ok]

---

<div class="post-metadata">

**Author:** ![Rajeev\_Prabhakar](https://avatars.discourse-cdn.com/v4/letter/r/f07891/32.png) [@Rajeev\_Prabhakar](https://community.deeplearning.ai/u/Rajeev_Prabhakar)\
**Post date:** [December 24, 2024, 1:15pm UTC](https://community.deeplearning.ai/t/de-c4w1a1-assignment/739721/7 "2024-12-24T13:15:07Z")

</div>

For step 2 you mentioned above, when I insert a cell above  
and run it, get an output ‘\<DATABASE\_ENDPOINT\>’

which is a problem, but, not sure how / why it is getting that incorrect value. b/c in my virtual env, profiles.yml under scripts  
dir as well as under ~/.dbt directory has correct host entries

(lab-venv) voclabs:~/environment/scripts

-rwxr-xr-x. 1 ec2-user ec2-user 312 Dec 24 11:29 profiles.yml  
(lab-venv) voclabs:~/environment/scripts cat profiles.yml classicmodels\_modeling: target: dev outputs: dev: type: postgres threads: 1 host: de-c4w1a1-rds.cdyoiwwa0br5.us-east-1.rds.amazonaws.com port: 5432 # optional dbname: postgres schema: classicmodels user: postgresuser password: adminpwrd (lab-venv) voclabs:~/environment/scripts pwd  
/home/ec2-user/environment/scripts

* * *

(lab-venv) voclabs:~/.dbt - cat profiles.yml  
classicmodels\_modeling:  
target: dev  
outputs:  
dev:  
type: postgres  
threads: 1  
host: [de-c4w1a1-rds.cdyoiwwa0br5.us-east-1.rds.amazonaws.com](http://de-c4w1a1-rds.cdyoiwwa0br5.us-east-1.rds.amazonaws.com)  
port: 5432 # optional  
dbname: postgres  
schema: classicmodels  
user: postgresuser  
password: adminpwrd  
(lab-venv) voclabs:~/.dbt pwd /home/ec2-user/.dbt (lab-venv) voclabs:~/.dbt

---

<div class="post-metadata">

**Author:** ![Amir\_Zare](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/amir_zare/32/95275_2.png) [@Amir\_Zare](https://community.deeplearning.ai/u/Amir_Zare)\
**Post date:** [December 24, 2024, 1:30pm UTC](https://community.deeplearning.ai/t/de-c4w1a1-assignment/739721/8 "2024-12-24T13:30:14Z")

</div>

Can you run this please?

```auto
cat ./scripts/profiles.yml

```

---

<div class="post-metadata">

**Author:** ![Rajeev\_Prabhakar](https://avatars.discourse-cdn.com/v4/letter/r/f07891/32.png) [@Rajeev\_Prabhakar](https://community.deeplearning.ai/u/Rajeev_Prabhakar)\
**Post date:** [December 24, 2024, 1:32pm UTC](https://community.deeplearning.ai/t/de-c4w1a1-assignment/739721/9 "2024-12-24T13:32:43Z")

</div>

> [@Amir\_Zare](#):
>
> `cat ./scripts/profiles.yml`

drwxr-xr-x. 10 ec2-user ec2-user 16384 Dec 24 11:24 classicmodels\_modeling  
drwxr-xr-x. 3 ec2-user ec2-user 138 Dec 24 11:29 scripts  
-rw-r–r–. 1 ec2-user ec2-user 54380 Dec 24 13:09 C4\_W1\_Assignment.ipynb  
(lab-venv) voclabs:~/environment $ cat ./scripts/profiles.yml  
classicmodels\_modeling:  
target: dev  
outputs:  
dev:  
type: postgres  
threads: 1  
host: [de-c4w1a1-rds.cdyoiwwa0br5.us-east-1.rds.amazonaws.com](http://de-c4w1a1-rds.cdyoiwwa0br5.us-east-1.rds.amazonaws.com)  
port: 5432 # optional  
dbname: postgres  
schema: classicmodels  
user: postgresuser  
password: adminpwrd  
(lab-venv) voclabs:~/environment  
Tue Dec 24 13:32:07 UTC 2024

---

<div class="post-metadata">

**Author:** ![Amir\_Zare](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/amir_zare/32/95275_2.png) [@Amir\_Zare](https://community.deeplearning.ai/u/Amir_Zare)\
**Post date:** [December 24, 2024, 1:40pm UTC](https://community.deeplearning.ai/t/de-c4w1a1-assignment/739721/10 "2024-12-24T13:40:12Z")

</div>

@Rajeev_Prabhakar I’m actually at my wits’ end here. I don’t know how it’s possible that the notebook cell is getting a wrong host value from the file 😅  
I suggest you change the line `DBHOST = DBCONFIG["host"]` in the notebook cell, and simply put the host value in front of it, like `DBHOST ='de-c4w1a1-rds.cdyoiwwa0br5.us-east-1.rds.amazonaws.com'`

---

<div class="post-metadata">

**Author:** ![Rajeev\_Prabhakar](https://avatars.discourse-cdn.com/v4/letter/r/f07891/32.png) [@Rajeev\_Prabhakar](https://community.deeplearning.ai/u/Rajeev_Prabhakar)\
**Post date:** [December 24, 2024, 1:40pm UTC](https://community.deeplearning.ai/t/de-c4w1a1-assignment/739721/11 "2024-12-24T13:40:58Z")

</div>

sure, I’ll do the cell entry per your advice…thank you !
