Skip to content

Commit f0a2b86

Browse files
committed
fixed instructions to include auto start
1 parent e18219c commit f0a2b86

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

INSTRUCTIONS.es.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ $ psql --version
1212
1313
A continuación, revisa el contenido del archivo `./.env` y sigue los pasos que se describen a continuación:
1414

15-
1. Crea un usuario nuevo para conectarte a tu base de datos: `$ psql -U postgres -c "CREATE USER gitpod;"`
16-
2. Crea una nueva base de datos dentro del motor de Postgres personalizando y ejecutando el siguiente comando: `$ psql -U postgres -c "CREATE DATABASE sample_db OWNER gitpod;"`
17-
3. Conéctate al motor de Postgres para utilizar tu base de datos, manipular tablas y datos: `$ psql -h localhost -U <username> <db_name>`
15+
1. Postgres es un servidor de bases de datos, debes iniciar el servidor antes de poder usarlo. Para iniciar Postgres en tu computadora, ejecuta el siguiente comando: `sudo service postgresql start`
16+
2. Crea un usuario nuevo para conectarte a tu base de datos: `$ psql -U postgres -c "CREATE USER gitpod;"`
17+
3. Crea una nueva base de datos dentro del motor de Postgres personalizando y ejecutando el siguiente comando: `$ psql -U postgres -c "CREATE DATABASE sample_db OWNER gitpod;"`
18+
4. Conéctate al motor de Postgres para utilizar tu base de datos, manipular tablas y datos: `$ psql -h localhost -U <username> <db_name>`
1819

1920
> NOTA: Recuerda revisar la información del fichero `./.env` para obtener el `username` y el `db_name`.
2021

INSTRUCTIONS.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ $ psql --version
1212
1313
Now, review the contents of the `./.env` file and follow the steps described below:
1414

15-
1. Create a new user to connect to your database: `psql -U postgres -c "CREATE USER gitpod;"`
16-
2. Create a new database within the Postgres engine by customizing and executing the following command: `psql -U postgres -c "CREATE DATABASE sample_db OWNER gitpod;"`
17-
3. Connect to the Postgres engine to use your database, manipulate tables and data: `$ psql -h localhost -U <username> <db_name>`
15+
1. Postgres is a database server, you have to start the server before you can use it. In order to stat postgres in your computer run the following command: `sudo service postgresql start`
16+
2. Create a new user to connect to your database: `psql -U postgres -c "CREATE USER gitpod;"`
17+
3. Create a new database within the Postgres engine by customizing and executing the following command: `psql -U postgres -c "CREATE DATABASE sample_db OWNER gitpod;"`
18+
4. Connect to the Postgres engine to use your database, manipulate tables and data: `$ psql -h localhost -U <username> <db_name>`
1819

1920
> NOTE: Remember to check the `./.env` file information to get or set the `username` and `db_name`.
2021

learn.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
"syntax": "python",
1515
"template_url": "self",
1616
"projectType": "project",
17-
"autoPlay": "false",
1817
"duration" : 2,
18+
"autoStart": "false",
1919
"description" : {
2020
"us": "Create a SQL database using the PostgreSQL engine and using a professional python project structure that includes PIP and environment variables.",
2121
"es": "Crea una base de datos SQL utilizando el motor PostgreSQL y una estructura de proyecto profesional en Python que incluya PIP y variables de entorno."

src/app.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
load_dotenv()
88

99
# 1) Connect to the database here using the SQLAlchemy's create_engine function
10+
connection_string = f"postgresql://{os.getenv('DB_USER')}:{os.getenv('DB_PASSWORD')}@{os.getenv('DB_HOST')}/{os.getenv('DB_NAME')}"
11+
engine = create_engine(connection_string).execution_options(autocommit=True)
12+
engine.connect()
1013

1114
# 2) Execute the SQL sentences to create your tables using the SQLAlchemy's execute function
1215

0 commit comments

Comments
 (0)