Mercurial > p > roundup > code
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 7722:7e2552cc0b62 | 7723:8147f6deac9f |
|---|---|
| 161 using ``roundup-admin init``. Setting the rdbms ``name`` | 161 using ``roundup-admin init``. Setting the rdbms ``name`` |
| 162 keyword to ``roundup_database.roundup_schema`` will create | 162 keyword to ``roundup_database.roundup_schema`` will create |
| 163 and use the ``roundup_schema`` in the pre-created | 163 and use the ``roundup_schema`` in the pre-created |
| 164 ``roundup_database``. | 164 ``roundup_database``. |
| 165 | 165 |
| 166 Also there is a new configuration keyword in the rdbms section of | 166 Also there is a new configuration keyword in the rdbms |
| 167 ``config.ini``. The ``service`` keyword allows you to define the | 167 section of ``config.ini``. The ``service`` keyword allows |
| 168 service name for Postgres that will be looked up in the Postgres | 168 you to define the service name for Postgres that will be |
| 169 `Connection Service File`_. Setting service to `roundup` with the | 169 looked up in the `Connection Service File`_. Any of the |
| 170 following in the service file:: | 170 methods of specifying the file including by using the |
| 171 ``PGSERVICEFILE`` environment variable are supported. | |
| 172 | |
| 173 This is similar to the existing support for MySQL | |
| 174 option/config files and groups. | |
| 175 | |
| 176 If you use services, any settings for the same properties | |
| 177 (user, name, password ...) that are in the tracker's | |
| 178 ``config.ini`` will override the service settings. So you | |
| 179 want to leave the ``config.ini`` settings blank. E.G.:: | |
| 180 | |
| 181 [rdbms] | |
| 182 name = | |
| 183 host = | |
| 184 port = | |
| 185 user = | |
| 186 password = | |
| 187 service = roundup_roundup | |
| 188 | |
| 189 Setting ``service`` to ``roundup_roundup`` with | |
| 190 the following in the service file:: | |
| 171 | 191 |
| 172 [roundup_roundup] | 192 [roundup_roundup] |
| 173 host=127.0.0.1 | 193 host=127.0.0.1 |
| 174 port=5432 | 194 port=5432 |
| 175 user=roundup | 195 user=roundup |
| 176 password=roundup | 196 password=roundup |
| 177 dbname=roundup | 197 dbname=roundup |
| 178 | 198 |
| 179 would use the roundup database with the specified credentials. | 199 would use the roundup database with the specified |
| 180 | 200 credentials. It is possible to define a service that |
| 181 It is possible to define a service that connects to a specific | 201 connects to a specific schema using:: |
| 182 schema. However this will require a little fiddling to get things | 202 |
| 183 working. A future enhancement may make using a schema via this | 203 options=-c search_path=roundup_service_dev |
| 184 mechanism easier. See https://issues.roundup-tracker.org/issue2551299 | 204 |
| 185 for details. | 205 Note that the first schema specified after ``search_path=`` |
| 206 is created and populated. The schema name | |
| 207 (``roundup_service_dev``) must be terminated by: a comma, | |
| 208 whitespace or end of line. | |
| 209 | |
| 210 You can use the command ``psql "service=db_service_name"`` | |
| 211 to verify the settings in the connection file. Inside of | |
| 212 ``psql`` you can verify the ``search_path`` using ``show | |
| 213 search_path;``. | |
| 186 | 214 |
| 187 .. _`Connection Service File`: https://www.postgresql.org/docs/current/libpq-pgservice.html | 215 .. _`Connection Service File`: https://www.postgresql.org/docs/current/libpq-pgservice.html |
| 188 | 216 |
| 189 Bad Login Rate Limiting and Locking (info) | 217 Bad Login Rate Limiting and Locking (info) |
| 190 ------------------------------------------ | 218 ------------------------------------------ |
