Mercurial > p > roundup > code
diff doc/upgrading.txt @ 7723:8147f6deac9f
fix(db): Make using pg_service work again.
When I did the merge of schema support I broke pg_service.conf support
by replacing get_database_name with db_schema_split. This commit
fixes it.
Also this commit returns the schema if one is specified in
pg_service.conf.
back_postgresql.py:
Replace calls to db_schema_split() with get_database_schema_names()
(new name for get_database_name()). Rename db_schema_split to
_db_schema_split. It now returns a tuple (dbname, schema) rather
than a list. It is used only by get_database_schema_names() which
also returns tuples.
get_database_schema_names() can also get schema info for the service
(if present) as specified by pg_service.conf.
Add get_database_user() to get the user from either RDBMS_USER or
pg_service.conf. (User needed for creating schema, so not needed
before schema patch.
import re at the top of file and remove lower import.
Remove some schema code from db_command as it's not needed. The
database conection is done to either postgresql or template1
existing databases. This command never connects to the roundp
specified db.
test/test_postgresql.py:
Reorganize top level imports, add import os. Replace import of
db_schema_split with get_database_schema_names. Also replace calls
to db_schema_split.
Create new Opener for the service file. Set PGSERVICEFILE to point
to test/pg_service.conf.
Add three new classes to test Service:
1) using regular db
2) using schema within db
3) Unable to parse schema name from pg_service.conf.
The last doesn't need a db. Number 1 and 2 reuse the tests in ROTest
to verify db connectivity.
test/pg_service.conf:
three service connections for: db only, db and schema, and incorrectly
specified schema test cases.
doc/upgrading.txt:
updated to current status. Included example schema definition in
service file.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Thu, 28 Dec 2023 15:13:42 -0500 |
| parents | 3071db43bfb6 |
| children | 68c04cc8edf7 |
line wrap: on
line diff
--- a/doc/upgrading.txt Wed Dec 27 23:14:01 2023 -0500 +++ b/doc/upgrading.txt Thu Dec 28 15:13:42 2023 -0500 @@ -163,11 +163,31 @@ and use the ``roundup_schema`` in the pre-created ``roundup_database``. -Also there is a new configuration keyword in the rdbms section of -``config.ini``. The ``service`` keyword allows you to define the -service name for Postgres that will be looked up in the Postgres -`Connection Service File`_. Setting service to `roundup` with the -following in the service file:: +Also there is a new configuration keyword in the rdbms +section of ``config.ini``. The ``service`` keyword allows +you to define the service name for Postgres that will be +looked up in the `Connection Service File`_. Any of the +methods of specifying the file including by using the +``PGSERVICEFILE`` environment variable are supported. + +This is similar to the existing support for MySQL +option/config files and groups. + +If you use services, any settings for the same properties +(user, name, password ...) that are in the tracker's +``config.ini`` will override the service settings. So you +want to leave the ``config.ini`` settings blank. E.G.:: + + [rdbms] + name = + host = + port = + user = + password = + service = roundup_roundup + +Setting ``service`` to ``roundup_roundup`` with +the following in the service file:: [roundup_roundup] host=127.0.0.1 @@ -176,13 +196,21 @@ password=roundup dbname=roundup -would use the roundup database with the specified credentials. - -It is possible to define a service that connects to a specific -schema. However this will require a little fiddling to get things -working. A future enhancement may make using a schema via this -mechanism easier. See https://issues.roundup-tracker.org/issue2551299 -for details. +would use the roundup database with the specified +credentials. It is possible to define a service that +connects to a specific schema using:: + + options=-c search_path=roundup_service_dev + +Note that the first schema specified after ``search_path=`` +is created and populated. The schema name +(``roundup_service_dev``) must be terminated by: a comma, +whitespace or end of line. + +You can use the command ``psql "service=db_service_name"`` +to verify the settings in the connection file. Inside of +``psql`` you can verify the ``search_path`` using ``show +search_path;``. .. _`Connection Service File`: https://www.postgresql.org/docs/current/libpq-pgservice.html
