Skip to content

Commit 7299c7f

Browse files
authored
Add extra NOTES to help connecting (#162)
1 parent b727eb5 commit 7299c7f

File tree

2 files changed

+83
-1
lines changed

2 files changed

+83
-1
lines changed

charts/postgresql/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ home: https://www.postgresql.org/
99
sources:
1010
- https://github.com/InseeFrLab/helm-charts-databases/tree/master/charts/postgresql
1111
type: application
12-
version: 1.0.10
12+
version: 1.0.11
1313
appVersion: 17.5.0
1414
dependencies:
1515
- name: postgresql

charts/postgresql/templates/NOTES.txt

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,47 @@
99
- Si vous avez besoin d'un accès admin à cette base de données (par exemple pour ajouter des extensions), les informations de connexion sont :
1010
- Admin username : **postgres**
1111
- Admin password : **{{ .Values.postgresql.auth.postgresPassword }}**
12+
13+
<details>
14+
<summary>Renseigner les variables d'environment</summary>
15+
16+
⚠️ Ces lignes ne doivent pas faire partie du code de votre projet ni être rendues publiques ⚠️
17+
18+
```sh
19+
export PGHOST="{{ template "common.names.fullname" . }}.{{ .Release.Namespace }}"
20+
export PGDATABASE="{{ .Values.postgresql.auth.database }}"
21+
export PGUSER="{{ .Values.postgresql.auth.username }}"
22+
export PGPASSWORD="{{ .Values.postgresql.auth.password }}"
23+
export PGPORT="{{ .Values.postgresql.service.ports.postgresql }}"
24+
```
25+
</details>
26+
27+
<details>
28+
<summary>Se connecter avec Python</summary>
29+
30+
Commencer par renseigner les variables d'environment.
31+
32+
```python
33+
import psycopg
34+
conn = psycopg.connect()
35+
with conn.cursor() as cur:
36+
print(cur.execute("SELECT version();").fetchone())
37+
conn.close()
38+
```
39+
</details>
40+
41+
<details>
42+
<summary>Se connecter avec R</summary>
43+
44+
Commencer par renseigner les variables d'environment.
45+
46+
```r
47+
library(DBI)
48+
conn <- dbConnect(RPostgres::Postgres())
49+
print(dbGetQuery(conn, "SELECT version();"))
50+
dbDisconnect(conn)
51+
```
52+
</details>
1253
{{- else }}
1354
{{- if ne .Values.userPreferences.language "en" -}}
1455
*NOTES are not supported for language `{{ .Values.userPreferences.language }}`... Defaulting to english.*
@@ -24,4 +65,45 @@
2465
- If you need admin access to this database (e.g. to add extensions), the connection information are :
2566
- Admin username : **postgres**
2667
- Admin password : **{{ .Values.postgresql.auth.postgresPassword }}**
68+
69+
<details>
70+
<summary>Setup environment variables</summary>
71+
72+
⚠️ These lines must not be included in your project's codebase, or otherwise published ⚠️
73+
74+
```sh
75+
export PGHOST="{{ template "common.names.fullname" . }}.{{ .Release.Namespace }}"
76+
export PGDATABASE="{{ .Values.postgresql.auth.database }}"
77+
export PGUSER="{{ .Values.postgresql.auth.username }}"
78+
export PGPASSWORD="{{ .Values.postgresql.auth.password }}"
79+
export PGPORT="{{ .Values.postgresql.service.ports.postgresql }}"
80+
```
81+
</details>
82+
83+
<details>
84+
<summary>Connect with Python</summary>
85+
86+
First set environment variables.
87+
88+
```python
89+
import psycopg
90+
conn = psycopg.connect()
91+
with conn.cursor() as cur:
92+
print(cur.execute("SELECT version();").fetchone())
93+
conn.close()
94+
```
95+
</details>
96+
97+
<details>
98+
<summary>Connect with R</summary>
99+
100+
First set environment variables.
101+
102+
```r
103+
library(DBI)
104+
conn <- dbConnect(RPostgres::Postgres())
105+
print(dbGetQuery(conn, "SELECT version();"))
106+
dbDisconnect(conn)
107+
```
108+
</details>
27109
{{- end -}}

0 commit comments

Comments
 (0)