-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Rework the storage framework to work nicely with PEP 249 #9295
Comments
what would this actually involve, in your mind? The codebase assumes database APIs which comply PEP249, as both psycopg2 and sqlite do. |
More directly work with PEP249 interfaces which's quirks are caught in the database engine modules, instead of embedding the quirks all over the place. Basically: Only consume Ofc only if this is possible with the way the framework is set up. The pros of this will be that it's incredibly easy to work with multiple database engine types, and possibly multiple SQL database types, but that's far-off. |
I'm still not sure what concrete changes are proposed here -- can you clarify what "storage framework" means to you? (Is it a particular class? A particular module?) |
Ah sorry, it's quite ambiguous, but i mean the target area of every part of synapse that either;
With "storage framework" i meant the entirety of |
can you give us some examples of what would change here? As far as I'm aware almost all of the code you mention already uses PEP-249-compliant interfaces. |
I saw quite a lot of It's about the prospect these were used regardless of aforementioned supposed compliance in the codebase, which makes me think there's much more uncareful usage of adapter quirks like that, i think much more subtle usages like these exist such as in This is all in anticipation for |
Right, yes we do use some extensions when using psycopg2 for performance reasons, and those tend to be gated behind a check to make sure we're using the
|
I can counter this with 4 lines from python zen;
While i'm not going to hold this up as the SSOT in regards to how we should approach this, it is how I look at most projects, and right now there is both ambiguity with
|
Extra note; Don't just think i'm just doing this for |
I had a chance to discuss this with the Synapse platform team today. We concluded that we are unlikely to take up this proposal: the necessary refactoring would be fairly invasive, and thus it would only be justified if it would address a specific, identified need. Until then, we are unfortunately resigned to conflating "Postgres" with "psycopg2". We wouldn't immediately reject a pull request which provides better abstraction, but it would face a particularly skeptical review. Example factors which could affect this conclusion:
|
(I'm happy to leave this open as a P5, but I'd need a new title which more clearly encapsulates a specific task that this issue represents) |
I currently believe this is the case, as you said in #9294 (comment), before re-opening this - once i have enough time to get around to it - i'll try to prove it, maybe with the load test. Thanks for taking the time to think about this, though. |
This is a "maybe" issue, but some elements of PEP 249 have already been implicitly coded into the codebase, such as
synapse.storage.types
, however, it could be easier to directly work with PEP 249's DB-API-v2 schema and approach to simplify the storage framework even further, and make (potential) future database engines easier to support.(Things such as module
.threadsafety
properties can maybe help futher granularize database pooling mechanisms dynamically.)The text was updated successfully, but these errors were encountered: