Skip to content

Adjust to provide for a generic database engine type#5

Draft
realtyem wants to merge 4 commits into
clokep:psycopg3from
realtyem:psycopg3-adjust-settings
Draft

Adjust to provide for a generic database engine type#5
realtyem wants to merge 4 commits into
clokep:psycopg3from
realtyem:psycopg3-adjust-settings

Conversation

@realtyem

@realtyem realtyem commented Nov 26, 2025

Copy link
Copy Markdown

Provide a new key in the database config of "driver" to be specific of the driver to use, which allows "name" to be a more generic "postgres" allowing swaping of the driver transparently to admins.

Default to "psycopg2", if "name" is set to "postgres". Allow for "name" to remain "psycopg2" for backwards compatibility.

This can easily be extended for sqlite3 as well

database:
  name: postgres
  driver: psycopg2  # or just do not include this
  args:
    ...
database:
  name: postgres
  driver: psycopg
  args:
    ...

Per conversation in element-hq#14586 (comment)

Provide a new key in the database config of "driver" to be specific of the driver to use, which
allows "name" to be a more generic "postgres" allowing swaping of the driver transparently to admins.

Default to "psycopg2", if "name" is set to "postgres". Allow for "name" to remain "psycopg2" for backwards
compatibility.
@github-actions github-actions Bot deployed to PR Documentation Preview November 27, 2025 12:16 Active
@realtyem

Copy link
Copy Markdown
Author

I chose not to add to upgrade.md at this time. I believe a few versions should go by before recommending/strongly suggesting such a change, to allow for rollback

@realtyem

Copy link
Copy Markdown
Author

I am not completely confident I regenerated the configuration docs correctly. The new script for such does not appear to be documented anywhere I could find

| `total_users` | int | The number of registered users on the homeserver. |
| `total_nonbridged_users` | int | The number of users, excluding those created by an Application Service. |
| `daily_user_type_native` | int | The number of native, non-guest users created in the last 24 hours. |
| `daily_user_type_native` | int | The number of native, non-guest users created in the last 24 hours. |

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not purposely change anything here, I suspect some kind of automated whitespace adjustment

raise ConfigError("Unsupported database type %r" % (db_engine,))

if db_engine == "sqlite3":
db_config["driver"] = "sqlite3"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is guarding against trying to use, for example, aiosqlite or something. No spoilers!

@github-actions github-actions Bot deployed to PR Documentation Preview November 27, 2025 13:30 Active
@github-actions github-actions Bot deployed to PR Documentation Preview December 4, 2025 03:19 Active
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant