Skip to content

Commit

Permalink
Drop support for ORACLE (again) (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhuppmann committed Sep 11, 2023
1 parent 17585c2 commit b0f403b
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 146 deletions.
27 changes: 10 additions & 17 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,13 @@ Or use `pytest` directly:
py.test
```

### Running tests with PostgreSQL and ORACLE
### Running tests with PostgreSQL

In order to run the local tests with PostgreSQL or ORACLE you'll need to have a local
instance of this database running.
The easiest way to do this using a docker container.
In order to run the local tests with PostgreSQL you'll need to have a local instance
of this database running. The easiest way to do this using a docker container.

For PostgreSQL using the official [`postgres`](https://hub.docker.com/_/postgres) image
is recommended. Get the latest version on you local machine using (having docker
installed):
Using the official [`postgres`](https://hub.docker.com/_/postgres) image is recommended.
Get the latest version on you local machine using (having docker installed):

```console
docker pull postgres
Expand All @@ -243,25 +241,20 @@ and run the container with:
docker run -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=test -p 5432:5432 -d postgres
```

for ORACLE you can use the the [`gvenzl/oracle-xe`](https://hub.docker.com/r/gvenzl/oracle-xe) image:

```console
docker pull gvenzl/oracle-xe
docker run -e ORACLE_RANDOM_PASSWORD=true -e APP_USER=ixmp4_test -e APP_USER_PASSWORD=ixmp4_test -p 1521:1521 -d gvenzl/oracle-xe
```

please note that you'll have to wait for a few seconds for the databases to be up and
Please note that you'll have to wait for a few seconds for the databases to be up and
running.

The `tests/docker-compose.yml` file might help you accomplish all of this with a single command for your convenience.
The `tests/docker-compose.yml` file might help you accomplish all of this with a single
command for your convenience.

```console
docker-compose -f tests/docker-compose.yml up
```

### Profiling

Some tests will output profiler information to the `.profiles/` directory (using the `profiled` fixture). You can analyze these using `snakeviz`. For example:
Some tests will output profiler information to the `.profiles/` directory (using the
`profiled` fixture). You can analyze these using `snakeviz`. For example:

```bash
snakeviz .profiles/test_add_datapoints_full_benchmark.prof
Expand Down
2 changes: 1 addition & 1 deletion doc/source/devs/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Package/Folder Structure
Architecture
------------

ixmp4 provides a Python API, a REST API and a compatibility layer for Oracle, Postgres and SQLite Databases.
ixmp4 provides a Python API, a REST API and a compatibility layer for Postgres and SQLite Databases.
The Python API can interact with databases directly or use the REST API of a compatible ixmp4 server instance.

::
Expand Down
25 changes: 6 additions & 19 deletions doc/source/devs/tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,15 @@ Alternatively, use ``pytest`` directly:
py.test
Running tests with PostgreSQL and ORACLE
----------------------------------------
Running tests with PostgreSQL
-----------------------------

In order to run the local tests with PostgreSQL or ORACLE you'll need to have a local
instance of this database running. The easiest way to do this is using a docker
container.
In order to run the local tests with PostgreSQL you'll need to have a local instance of
this database running. The easiest way to do this is using a docker container.

The docker container of the database needs to be started first and then the tests can be
run normally using pytest. If everything is working correctly, the tests for ORACLE or
PostgreSQL should not be skipped.

run normally using pytest. If everything is working correctly, the tests for PostgreSQL
should not be skipped.

For PostgreSQL using the official `postgres <https://hub.docker.com/_/postgres>`_ image
is recommended. Get the latest version on your local machine using (having docker
Expand All @@ -50,17 +48,6 @@ and run the container with:
docker run -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=test -p 5432:5432 -d postgres
for ORACLE you can use the `gvenzl/oracle-xe`
<https://hub.docker.com/r/gvenzl/oracle-xe>`_ image:

.. code:: bash
docker pull gvenzl/oracle-xe
docker run -e ORACLE_RANDOM_PASSWORD=true -e APP_USER=ixmp4_test -e APP_USER_PASSWORD=ixmp4_test -p 1521:1521 -d gvenzl/oracle-xe
please note that you'll have to wait for a few seconds for the databases to be up and
running.

In case there are any error messages during the start up of the container along those lines:

.. code:: bash
Expand Down
3 changes: 1 addition & 2 deletions ixmp4/data/db/iamc/datapoint/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ class DataPointRepository(

def __init__(self, *args, **kwargs) -> None:
backend, *_ = args
# A different underlying database table
# needed to be used for oracle databases.
# A different table was used for ORACLE databases (deprecated since ixmp4 0.3.0)
self.model_class = get_datapoint_model(backend.session)

self.timeseries = TimeSeriesRepository(*args, **kwargs)
Expand Down
Loading

0 comments on commit b0f403b

Please sign in to comment.