-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME
More file actions
74 lines (42 loc) · 2.05 KB
/
README
File metadata and controls
74 lines (42 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
| Role | Tool | SQL used for |
| -------------- | ------------------ | ---------------------------------------- |
| Analyst | Metabase, Tableau | Answering business questions |
| Data Engineer | dbt, Airflow, Bash | Cleaning & transforming data (ETL) |
| Developer | Flask, FastAPI | Powering app features (e.g. orders view) |
| Data Scientist | Jupyter, Pandas | Extracting training data for ML |
!sudo apt update
!sudo apt install postgresql postgresql-contrib -y
!sudo service postgresql start
Check the daemon status
!sudo service postgresql status
Switch to postgres user and open the psql shell
!sudo -i -u postgres
!psql
After the previous command, the prompt should look like this:
postgres=#
CREATE DATABASE mytestdb;
CREATE USER mytestuser WITH ENCRYPTED PASSWORD 'mypassword';
GRANT ALL PRIVILEGES ON DATABASE mytestdb TO mytestuser;
The previous command is needed to give the user privileges to create tables etc
Edit this file to allow access to database from other IPs:
!sudo nano /etc/postgresql/*/main/postgresql.conf
Look for this line and make it look like this (normally you should find localhost instead *)
listen_addresses = '*'
!sudo nano /etc/postgresql/*/main/pg_hba.conf
Add this line at the bottom
host all all 0.0.0.0/0 md5
!sudo service postgresql restart
After this procedure you should be aple to configure your psql connection from VSCode
For a full real-case project, you might want:
More tables (e.g., projects, performance_reviews, salaries_over_time)
Real data volume simulation (1000s of rows, not 5)
ETL scripts or Python code to connect to the database
Schema evolution: migrations, altering tables, version control
Business questions that simulate reporting needs
######
sudo -i -u postgres
createdb ecommerce_db
psql ecommerce_db
CREATE ROLE gturtu21 WITH LOGIN PASSWORD 'yourpasswordblablabla';
Create database from the file setup.sql
psql -U gturtu2 -d ecommerce_db -f setup.sql