Repository navigation
What class to use to implement or migrate database modules #884
Description
Activity
DbContaineris great but the idea was to move to a more generic hierarchy where we can extendServerContainerto things likeDbContainer. The oldtestcontainers.core.genericwill be removed eventually after a proper replacement been made, something likemodules.generic.testcontainers.generic.db(I imagine) that users can migrate fromDbContainerwith ease 😊Sounds good, is there any issue where we can find the plan for
modules.generic.testcontainers.generic.dbI'm not sure that inheriting
DockerContainer -> ServerContainer -> DBContainermakes sense,ServerContaineris just an HTTP specialization ofDockerContainer, while some database might implement HTTP most don't.i think the deprecation may be pre-mature in that there is no real alternative right now but it does represent the opinion that we do not want to rely on a sql health check or build the urls the same way for all databases. i think both of these remain bad assumptions. if you want to use them for now i think that is fine - esp if it is merged in here because i will clean that up when we get around to it. i dont want to make people install sqlalchemy if they dont have to. if it is useful for cratedb, lets add it as an optional dependency for the "crate" extra (pip install testcontainers[cratedb])
DockerContainer -> ServerContainer -> DBContaineris not the direction, sorry if that got lost on the way,DBContainerjust should not be part of core.. but as a module likemodules.generic.testcontainers.generic.dband doesn't have to includeServerContainerin any way, hope that help to clarify.
(I'll try to get a draft ready soon)
The idea/philosophy here that core should not include specific modules (even if we add the word "generic" to them 😅), those are just more modules that we can handle and maintain undermodules.genericReacted by IvanPlease checkout #892
- linked a pull request that will close this issuefeat(generic): Reintroducing the generic SQL module #892
on Oct 3, 2025 I think that the information provided in this issue is enough to answer the original question, thank you very much!
Reacted by Roy Moore- added a commit that references this issue
on Mar 29, 2026
Most modules use the
testcontainers.core.generic.DbContainerclass, but it is marked as deprecated, should we usetestcontainers.generic.ServerContainer?DbContainerhad a couple of generics for most databases like uri creation and sqlalchemy connect in_connect, do we just lose that and every module needs to implement their own or would it be ok to re-implementDbContainerfromServerContainerto keep the database specific things?