File: README.md

package info (click to toggle)
python-oracledb 1.2.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 5,224 kB
  • sloc: python: 17,637; sql: 1,819; makefile: 41
file content (55 lines) | stat: -rw-r--r-- 1,279 bytes parent folder | download
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
# python-oracledb Samples in a Container

This Dockerfile creates a container with python-oracledb samples and a running
Oracle Database.

It has been tested in an Oracle Linux 8 environment using 'podman', but
'docker' should work too.

## Usage

- Get an Oracle Database container (see
  https://hub.docker.com/r/gvenzl/oracle-xe):

  ```
  podman pull docker.io/gvenzl/oracle-xe:21-slim
  ```

- Create a container with the database, Python, python-oracledb and the
  samples. Choose a password for the sample schemas and pass it as an argument:

  ```
  podman build -t pyo --build-arg PYO_PASSWORD=a_secret .
  ```

- Start the container, which creates the database. Choose a password for the
  privileged database users and pass it as a variable:

  ```
  podman run -d --name pyo -p 1521:1521 -it -e ORACLE_PASSWORD=a_secret_password pyo
  ```

- Log into the container:

  ```
  podman exec -it pyo bash
  ```

- At the first login, create the sample schema:

  ```
  python setup.py
  ```

  The schema used can be seen in `sql/create_schema.sql`

- In the container, run samples like:

  ```
  python bind_insert.py
  ```

  Use `vim` to edit files, if required.

The database will persist across container shutdowns, but will be deleted when
the container is deleted.